dry-clean.vue 11 KB

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