dry-clean.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451
  1. <template>
  2. <view class="dry-clean-box iPhone-bottom flex-common-css box-border-box">
  3. <Nav title='干洗'></Nav>
  4. <view class="head-box box-border-box p-24 flex-justify-space">
  5. <image v-if="!siteData.logo" src="@/static/img/logo/logo.png" mode="aspectFill"></image>
  6. <image v-else :src="siteData.logo" mode="aspectFill"></image>
  7. <view class="flex-1">
  8. <view class="display-flex mb-16">
  9. <view class="w410 fs-40 fw-600 text-overflow-ellipsis-one">{{siteData.name?siteData.name:'请选择站点'}}
  10. </view>
  11. <view class="fs-28 fw-400 fc-41ABF5 text-align-right" @click="selectsShop()">
  12. 【{{siteData.name?'切换':'选择'}}站点】</view>
  13. </view>
  14. <view class="display-flex">
  15. <view v-if="siteData.city_name||siteData.address" class="w410 fs-26 fw-400 fc-9">
  16. {{siteData.city_name}}{{siteData.address}}
  17. </view>
  18. <view v-else class="w410 fs-26 fw-400 fc-9">请选择站点已提供服务</view>
  19. <!-- <view class="text-align-center" style="margin-left: auto;">
  20. <view class="text-align-right">
  21. <uni-icons type="location" size="20"></uni-icons>
  22. </view>
  23. <view class="fs-26 fc-9">{{siteData.distance||'0'}}km</view>
  24. </view> -->
  25. </view>
  26. </view>
  27. </view>
  28. <view class="box-border-box p-24" @click="openText()">
  29. <view class="sy-box flex-justify-space box-border-box p-16">
  30. <view class="align-items-center">
  31. <uni-icons type="help" size="20" color="#FB3D03"></uni-icons>
  32. <view class="fc-6 fs-28 ml-10 fc-FB3D03">使用须知</view>
  33. </view>
  34. <image src="@/static/img/toRight.png" mode=""></image>
  35. </view>
  36. </view>
  37. <!-- 列表 -->
  38. <view class="common-view-css bgc-f" style="overflow: hidden;">
  39. <Menu ref="menuBox" style="height: 100%;" @relCardBuy='relCardBuy'></Menu>
  40. </view>
  41. <view class="shop-buttom-money box-border-box">
  42. <view class="shop-buttom-money-1 flex-justify-space align-items-center">
  43. <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill" @click="openBuyCrad()"></image>
  44. <view class="shop-buttom-num fs-24 fc-f text-align-center" @click="openBuyCrad()">
  45. {{cardData.total_num||'0'}}
  46. </view>
  47. <view class="">
  48. <view class="">
  49. <span class="fw-600 fs-24 fc-f">¥</span>
  50. <span class="fw-600 fs-44 fc-f">{{cardData.total_price ||'0'}}</span>
  51. </view>
  52. <view class="fc-f">
  53. 配送费: {{siteData.delivery_money?siteData.delivery_money:'0.00'}}
  54. </view>
  55. </view>
  56. <view class="shop-buttom-money-2 text-align-center fc-f fs-32 fw-600" @click="createOrder()">去结算</view>
  57. </view>
  58. </view>
  59. <uni-popup ref="popupBuy" type="bottom">
  60. <view class="buy-card flex-index-css">
  61. <view class="buy-card-top box-border-box plr-32 flex-justify-space align-items-center">
  62. <view class="">
  63. <span class="fs-32 fc-3 mr-12">已选商品</span>
  64. </view>
  65. <view class="fs-28 fw-400 fc-9 align-items-center">
  66. <view class="">
  67. <uni-icons type="trash" size="18" color="#999"></uni-icons>
  68. </view>
  69. <view class="fs-28 fw-400 fc-9" @click="cardAllDel()">清空</view>
  70. </view>
  71. </view>
  72. <view class="scroll-view-css box-border-box p-32">
  73. <view class="buy-card-item display-flex" v-for="(item,i) in cardData.goods_list" :key="i">
  74. <image class="goods_img" :src="item.goods_image" mode="scaleToFill"></image>
  75. <view class="flex-1">
  76. <view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-40">{{item.goods_name}}</view>
  77. <view class="flex-justify-space">
  78. <view class="">
  79. <span class="fs-24 fc-FB3D03 fw-400">¥</span>
  80. <span class="fs-40 fc-FB3D03 fw-b">{{item.price}}</span>
  81. </view>
  82. <view class="display-flex align-items-center">
  83. <!-- <view v-show="item.number > 0"
  84. class="right-only-right-red fw-500 text-align-center fs-36 fc-f"
  85. @click="addred(1,item)">-</view> -->
  86. <image v-show="item.number > 0" class="wh-44" @click="addred(1,item)"
  87. src="@/static/img/takeout/j.png" mode=""></image>
  88. <view v-show="item.number > 0"
  89. class="right-only-right-2 text-align-center fs-28 fw-400">{{item.number}}</view>
  90. <image class="wh-44" src="@/static/img/takeout/add.png" @click="addred(2,item)"
  91. mode=""></image>
  92. <!-- <view class="right-only-right-add fw-500 text-align-center fs-36 fc-f"
  93. @click="addred(2,item)">+</view> -->
  94. </view>
  95. </view>
  96. </view>
  97. </view>
  98. </view>
  99. <view class="shop-buttom-money box-border-box" @click="createOrder()">
  100. <view class="shop-buttom-money-1 flex-justify-space align-items-center">
  101. <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
  102. <view class="shop-buttom-num fs-24 fc-f text-align-center">{{cardData.total_num||'0'}}</view>
  103. <view class="">
  104. <view class="">
  105. <span class="fw-600 fs-24 fc-f">¥</span>
  106. <span class="fw-600 fs-44 fc-f">{{cardData.total_price ||'0'}}</span>
  107. </view>
  108. <view class="fc-f">
  109. 配送费: {{siteData.delivery_money?siteData.delivery_money:'0.00'}}
  110. </view>
  111. </view>
  112. <view class="shop-buttom-money-2 text-align-center fs-32 fc-f fw-600">去结算</view>
  113. </view>
  114. </view>
  115. </view>
  116. </uni-popup>
  117. <uni-popup ref="popupText" type="bottom">
  118. <view class="use-box box-border-box p-16">
  119. <view class="head-pop flex-justify-space align-items-center mb-24">
  120. <uni-icons type="closeempty" size="24" color="#fff"></uni-icons>
  121. <view class="fs-36 fc-0 fw-600">使用须知</view>
  122. <uni-icons @click.stop="closeMsg()" type="closeempty" size="24"></uni-icons>
  123. </view>
  124. <view class="scroll-view-css" v-html="laundry_str"></view>
  125. </view>
  126. </uni-popup>
  127. </view>
  128. </template>
  129. <script>
  130. import {
  131. setShopIngNumber,
  132. setShopIngDel,
  133. getShopIngList,
  134. setShopIngAdd,
  135. } from '@/api/shopping.js'
  136. import {
  137. getCommonText
  138. } from '@/api/common.js';
  139. import Menu from './dry-mod/menu.vue';
  140. import tools from "@/service/tools";
  141. export default {
  142. components: {
  143. Menu
  144. },
  145. data() {
  146. return {
  147. laundry_str: '',
  148. siteData: {
  149. id: '',
  150. school_id: '',
  151. name: '',
  152. logo: '',
  153. distance: 0,
  154. city_name: '',
  155. address: '',
  156. },
  157. cardData: {
  158. goods_list: [],
  159. total_num: 0,
  160. total_price: 0,
  161. },
  162. total_price: '',
  163. isAJAX: false,
  164. }
  165. },
  166. onLoad(e) {
  167. if (e.data) {
  168. this.siteData = JSON.parse(decodeURIComponent(e.data));
  169. }
  170. },
  171. onShow() {
  172. this.getText();
  173. this.getCardList();
  174. },
  175. methods: {
  176. cardAllDel() {
  177. if (this.cardData.goods_list.length > 0) {
  178. let school_id = uni.getStorageSync('school_id');
  179. setShopIngDel({
  180. type: 3,
  181. school_id: school_id
  182. }).then((res) => {
  183. if (res.code === 1) {
  184. this.cardData.goods_list = [];
  185. this.getCardList();
  186. this.$refs.menuBox.getTypeList();
  187. } else {
  188. tools.error('清空失败')
  189. }
  190. })
  191. } else {
  192. tools.error('暂未选择商品')
  193. }
  194. },
  195. relCardBuy() {
  196. // 重置购物车
  197. this.getCardList();
  198. },
  199. getCardList() {
  200. let school_id = uni.getStorageSync('school_id');
  201. getShopIngList({
  202. type: 3,
  203. school_id: school_id
  204. }).then((res) => {
  205. if (res.code === 1) {
  206. this.cardData = res.data;
  207. }
  208. })
  209. },
  210. getText() {
  211. getCommonText().then((res) => {
  212. if (res.code === 1) {
  213. this.laundry_str = res.data.laundry_str
  214. }
  215. })
  216. },
  217. selectsShop() {
  218. uni.navigateTo({
  219. url: '/pages-buy/dry-mod/select-shop?id=' + this.siteData.id
  220. })
  221. },
  222. openText() {
  223. this.$refs.popupText.open()
  224. },
  225. closeMsg() {
  226. this.$refs.popupText.close()
  227. },
  228. openBuyCrad() {
  229. this.$refs.popupBuy.open()
  230. },
  231. addred(type, info) {
  232. if (this.isAJAX) {
  233. return
  234. }
  235. this.isAJAX = true;
  236. if (type === 1) {
  237. // 减
  238. let school_id = uni.getStorageSync('school_id');
  239. setShopIngNumber({
  240. type: 3,
  241. goods_id: info.goods_id,
  242. category_id: info.category_id,
  243. operation: 2,
  244. school_id: school_id
  245. }).then((res) => {
  246. if (res.code === 1) {
  247. this.isAJAX = false;
  248. info.num -= 1;
  249. this.getCardList();
  250. this.$refs.menuBox.getTypeList();
  251. } else {
  252. this.isAJAX = false;
  253. tools.error(res.msg)
  254. }
  255. })
  256. } else if (type === 2) {
  257. // 加
  258. let school_id = uni.getStorageSync('school_id');
  259. setShopIngAdd({
  260. type: 3,
  261. goods_id: info.goods_id,
  262. category_id: info.category_id,
  263. school_id: school_id
  264. }).then((res) => {
  265. if (res.code === 1) {
  266. this.isAJAX = false;
  267. info.num += 1;
  268. this.getCardList();
  269. this.$refs.menuBox.getTypeList();
  270. } else {
  271. this.isAJAX = false;
  272. tools.error(res.msg)
  273. }
  274. })
  275. }
  276. },
  277. createOrder() {
  278. if (this.cardData.goods_list.length == 0) {
  279. return tools.error('请选择商品')
  280. }
  281. if (!this.siteData.id) {
  282. return tools.error('请选择站点')
  283. }
  284. console.log(this.siteData, '$$$$$$$$$$$');
  285. uni.navigateTo({
  286. url: '/pages-buy/save-dry?id=' + this.siteData.id + '&siteData_name=' + this.siteData.name +
  287. '&delivery_money=' + this.siteData.delivery_money + '&siteData_logo=' + this.siteData.logo
  288. })
  289. },
  290. },
  291. }
  292. </script>
  293. <style scoped lang="scss">
  294. .wh-44 {
  295. width: 44rpx;
  296. height: 44rpx;
  297. }
  298. .use-box {
  299. width: 100%;
  300. height: 70vh;
  301. background-color: #fff;
  302. border-radius: 24rpx 24rpx 0rpx 0rpx;
  303. display: flex;
  304. flex-direction: column;
  305. .head-pop {
  306. padding-bottom: 34rpx !important;
  307. border-bottom: 1rpx solid #F2F2F2;
  308. }
  309. }
  310. .dry-clean-box {
  311. background-color: #fff;
  312. .right-only-right-red {
  313. width: 44rpx;
  314. height: 44rpx;
  315. line-height: 40rpx;
  316. border-radius: 12rpx;
  317. border: 1rpx solid #41ABF5;
  318. color: #41ABF5;
  319. }
  320. .right-only-right-add {
  321. width: 44rpx;
  322. height: 44rpx;
  323. line-height: 40rpx;
  324. background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
  325. border-radius: 12rpx;
  326. }
  327. .right-only-right-2 {
  328. min-width: 50rpx;
  329. }
  330. .w-514 {
  331. width: 514rpx;
  332. }
  333. .w410 {
  334. width: 410rpx;
  335. }
  336. .head-box {
  337. background-color: #fff;
  338. box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(51, 51, 51, 0.06);
  339. image {
  340. width: 100rpx;
  341. height: 100rpx;
  342. border-radius: 8rpx;
  343. margin-right: 18rpx;
  344. }
  345. }
  346. .sy-box {
  347. width: 100%;
  348. height: 60rpx;
  349. background: #F2F2F2;
  350. border-radius: 16rpx 16rpx 16rpx 16rpx;
  351. image {
  352. width: 32rpx;
  353. height: 32rpx;
  354. }
  355. }
  356. .shop-buttom-money {
  357. width: 100%;
  358. height: 140rpx;
  359. background: rgba(255, 255, 255, 0.8);
  360. padding: 20rpx 24rpx;
  361. .shop-buttom-money-1 {
  362. width: 100%;
  363. height: 100%;
  364. background: #333333;
  365. border-radius: 200rpx;
  366. box-sizing: border-box;
  367. padding-left: 136rpx;
  368. // padding-right: 32rpx;
  369. position: relative;
  370. image {
  371. position: absolute;
  372. bottom: 0;
  373. left: 8rpx;
  374. width: 128rpx;
  375. height: 128rpx;
  376. }
  377. .shop-buttom-num {
  378. width: 32rpx;
  379. height: 32rpx;
  380. line-height: 32rpx;
  381. background: #FB3D03;
  382. border-radius: 50%;
  383. position: absolute;
  384. top: 36rpx;
  385. left: 82rpx;
  386. }
  387. .shop-buttom-money-2 {
  388. width: 200rpx;
  389. height: 100rpx;
  390. line-height: 100rpx;
  391. background: #41ABF5;
  392. border-radius: 0rpx 200rpx 200rpx 0rpx;
  393. }
  394. }
  395. }
  396. .buy-card {
  397. height: 828rpx;
  398. background-color: #fff;
  399. border-radius: 24rpx 24rpx 0rpx 0rpx;
  400. .buy-card-top {
  401. width: 100%;
  402. height: 92rpx;
  403. background: #FCF5DB;
  404. border-radius: 24rpx 24rpx 0rpx 0rpx;
  405. }
  406. .buy-card-item {
  407. width: 100%;
  408. height: 176rpx;
  409. margin-bottom: 32rpx;
  410. .goods_img {
  411. width: 152rpx;
  412. height: 152rpx;
  413. border-radius: 12rpx;
  414. margin-right: 20rpx;
  415. }
  416. }
  417. }
  418. }
  419. </style>