dry-clean.vue 10 KB

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