dry-clean.vue 11 KB

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