dry-clean.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449
  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. onShow() {
  167. uni.$once('stationData', data => {
  168. this.siteData = data
  169. })
  170. this.getText();
  171. this.getCardList();
  172. },
  173. methods: {
  174. cardAllDel() {
  175. if (this.cardData.goods_list.length > 0) {
  176. let school_id = uni.getStorageSync('school_id');
  177. setShopIngDel({
  178. type: 3,
  179. school_id: school_id
  180. }).then((res) => {
  181. if (res.code === 1) {
  182. this.cardData.goods_list = [];
  183. this.getCardList();
  184. this.$refs.menuBox.getTypeList();
  185. } else {
  186. tools.error('清空失败')
  187. }
  188. })
  189. } else {
  190. tools.error('暂未选择商品')
  191. }
  192. },
  193. relCardBuy() {
  194. // 重置购物车
  195. this.getCardList();
  196. },
  197. getCardList() {
  198. let school_id = uni.getStorageSync('school_id');
  199. getShopIngList({
  200. type: 3,
  201. school_id: school_id
  202. }).then((res) => {
  203. if (res.code === 1) {
  204. this.cardData = res.data;
  205. }
  206. })
  207. },
  208. getText() {
  209. getCommonText().then((res) => {
  210. if (res.code === 1) {
  211. this.laundry_str = res.data.laundry_str
  212. }
  213. })
  214. },
  215. selectsShop() {
  216. uni.navigateTo({
  217. url: '/pages-buy/dry-mod/select-shop?id=' + this.siteData.id
  218. })
  219. },
  220. openText() {
  221. this.$refs.popupText.open()
  222. },
  223. closeMsg() {
  224. this.$refs.popupText.close()
  225. },
  226. openBuyCrad() {
  227. this.$refs.popupBuy.open()
  228. },
  229. addred(type, info) {
  230. if (this.isAJAX) {
  231. return
  232. }
  233. this.isAJAX = true;
  234. if (type === 1) {
  235. // 减
  236. let school_id = uni.getStorageSync('school_id');
  237. setShopIngNumber({
  238. type: 3,
  239. goods_id: info.goods_id,
  240. category_id: info.category_id,
  241. operation: 2,
  242. school_id: school_id
  243. }).then((res) => {
  244. if (res.code === 1) {
  245. this.isAJAX = false;
  246. info.num -= 1;
  247. this.getCardList();
  248. this.$refs.menuBox.getTypeList();
  249. } else {
  250. this.isAJAX = false;
  251. tools.error(res.msg)
  252. }
  253. })
  254. } else if (type === 2) {
  255. // 加
  256. let school_id = uni.getStorageSync('school_id');
  257. setShopIngAdd({
  258. type: 3,
  259. goods_id: info.goods_id,
  260. category_id: info.category_id,
  261. school_id: school_id
  262. }).then((res) => {
  263. if (res.code === 1) {
  264. this.isAJAX = false;
  265. info.num += 1;
  266. this.getCardList();
  267. this.$refs.menuBox.getTypeList();
  268. } else {
  269. this.isAJAX = false;
  270. tools.error(res.msg)
  271. }
  272. })
  273. }
  274. },
  275. createOrder() {
  276. if (this.cardData.goods_list.length == 0) {
  277. return tools.error('请选择商品')
  278. }
  279. if (!this.siteData.id) {
  280. return tools.error('请选择站点')
  281. }
  282. console.log(this.siteData, '$$$$$$$$$$$');
  283. uni.navigateTo({
  284. url: '/pages-buy/save-dry?id=' + this.siteData.id + '&siteData_name=' + this.siteData.name +
  285. '&delivery_money=' + this.siteData.delivery_money + '&siteData_logo=' + this.siteData.logo
  286. })
  287. },
  288. },
  289. }
  290. </script>
  291. <style scoped lang="scss">
  292. .wh-44 {
  293. width: 44rpx;
  294. height: 44rpx;
  295. }
  296. .use-box {
  297. width: 100%;
  298. height: 70vh;
  299. background-color: #fff;
  300. border-radius: 24rpx 24rpx 0rpx 0rpx;
  301. display: flex;
  302. flex-direction: column;
  303. .head-pop {
  304. padding-bottom: 34rpx !important;
  305. border-bottom: 1rpx solid #F2F2F2;
  306. }
  307. }
  308. .dry-clean-box {
  309. background-color: #fff;
  310. .right-only-right-red {
  311. width: 44rpx;
  312. height: 44rpx;
  313. line-height: 40rpx;
  314. border-radius: 12rpx;
  315. border: 1rpx solid #41ABF5;
  316. color: #41ABF5;
  317. }
  318. .right-only-right-add {
  319. width: 44rpx;
  320. height: 44rpx;
  321. line-height: 40rpx;
  322. background: linear-gradient(117deg, #57CAFF 0%, #41ABF5 100%);
  323. border-radius: 12rpx;
  324. }
  325. .right-only-right-2 {
  326. min-width: 50rpx;
  327. }
  328. .w-514 {
  329. width: 514rpx;
  330. }
  331. .w410 {
  332. width: 410rpx;
  333. }
  334. .head-box {
  335. background-color: #fff;
  336. box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(51, 51, 51, 0.06);
  337. image {
  338. width: 100rpx;
  339. height: 100rpx;
  340. border-radius: 8rpx;
  341. margin-right: 18rpx;
  342. }
  343. }
  344. .sy-box {
  345. width: 100%;
  346. height: 60rpx;
  347. background: #F2F2F2;
  348. border-radius: 16rpx 16rpx 16rpx 16rpx;
  349. image {
  350. width: 32rpx;
  351. height: 32rpx;
  352. }
  353. }
  354. .shop-buttom-money {
  355. width: 100%;
  356. height: 140rpx;
  357. background: rgba(255, 255, 255, 0.8);
  358. padding: 20rpx 24rpx;
  359. .shop-buttom-money-1 {
  360. width: 100%;
  361. height: 100%;
  362. background: #333333;
  363. border-radius: 200rpx;
  364. box-sizing: border-box;
  365. padding-left: 136rpx;
  366. // padding-right: 32rpx;
  367. position: relative;
  368. image {
  369. position: absolute;
  370. bottom: 0;
  371. left: 8rpx;
  372. width: 128rpx;
  373. height: 128rpx;
  374. }
  375. .shop-buttom-num {
  376. width: 32rpx;
  377. height: 32rpx;
  378. line-height: 32rpx;
  379. background: #FB3D03;
  380. border-radius: 50%;
  381. position: absolute;
  382. top: 36rpx;
  383. left: 82rpx;
  384. }
  385. .shop-buttom-money-2 {
  386. width: 200rpx;
  387. height: 100rpx;
  388. line-height: 100rpx;
  389. background: #41ABF5;
  390. border-radius: 0rpx 200rpx 200rpx 0rpx;
  391. }
  392. }
  393. }
  394. .buy-card {
  395. height: 828rpx;
  396. background-color: #fff;
  397. border-radius: 24rpx 24rpx 0rpx 0rpx;
  398. .buy-card-top {
  399. width: 100%;
  400. height: 92rpx;
  401. background: #FCF5DB;
  402. border-radius: 24rpx 24rpx 0rpx 0rpx;
  403. }
  404. .buy-card-item {
  405. width: 100%;
  406. height: 176rpx;
  407. margin-bottom: 32rpx;
  408. .goods_img {
  409. width: 152rpx;
  410. height: 152rpx;
  411. border-radius: 12rpx;
  412. margin-right: 20rpx;
  413. }
  414. }
  415. }
  416. }
  417. </style>