dry-clean.vue 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361
  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 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">清空</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} 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. relCardBuy(){
  147. // 重置购物车
  148. this.getCardList();
  149. },
  150. getCardList(){
  151. getShopIngList({type:3}).then((res)=>{
  152. if(res.code === 1){
  153. this.cardData = res.data;
  154. }
  155. })
  156. },
  157. getText(){
  158. getCommonText().then((res)=>{
  159. if(res.code === 1){
  160. this.laundry_str = res.data.laundry_str
  161. }
  162. })
  163. },
  164. selectsShop(){
  165. uni.navigateTo({
  166. url:'/pages-buy/dry-mod/select-shop?id=' + this.siteData.id
  167. })
  168. },
  169. openText(){
  170. this.$refs.popupText.open()
  171. },
  172. closeMsg(){
  173. this.$refs.popupText.close()
  174. },
  175. openBuyCrad(){
  176. this.$refs.popupBuy.open()
  177. },
  178. addred(type,item,info){
  179. if(this.isAJAX){
  180. return
  181. }
  182. this.isAJAX = true;
  183. if(type === 1){
  184. // 减
  185. setShopIngNumber({type:3,goods_id:info.goods_id,category_id:item.type,operation:2}).then((res)=>{
  186. if(res.code === 1){
  187. this.isAJAX = false;
  188. info.num -= 1;
  189. }else{
  190. this.isAJAX = false;
  191. tools.error(res.msg)
  192. }
  193. })
  194. }else if(type === 2){
  195. // 加
  196. setShopIngAdd({type:3,goods_id:info.goods_id,category_id:item.type}).then((res)=>{
  197. if(res.code === 1){
  198. this.isAJAX = false;
  199. info.num += 1;
  200. }else{
  201. this.isAJAX = false;
  202. tools.error(res.msg)
  203. }
  204. })
  205. }
  206. },
  207. createOrder(){
  208. },
  209. },
  210. }
  211. </script>
  212. <style scoped lang="scss">
  213. .use-box{
  214. width: 100%;
  215. height: 70vh;
  216. background-color: #fff;
  217. border-radius: 24rpx 24rpx 0rpx 0rpx;
  218. display: flex;
  219. flex-direction: column;
  220. .head-pop{
  221. padding-bottom: 34rpx !important;
  222. border-bottom: 1rpx solid #F2F2F2;
  223. }
  224. }
  225. .dry-clean-box{
  226. background-color: #fff;
  227. .right-only-right-red{
  228. width: 44rpx;
  229. height: 44rpx;
  230. line-height: 40rpx;
  231. border-radius: 12rpx;
  232. border: 1rpx solid #41ABF5;
  233. color: #41ABF5;
  234. }
  235. .right-only-right-add{
  236. width: 44rpx;
  237. height: 44rpx;
  238. line-height: 40rpx;
  239. background: linear-gradient( 117deg, #57CAFF 0%, #41ABF5 100%);
  240. border-radius: 12rpx;
  241. }
  242. .right-only-right-2{
  243. min-width: 50rpx;
  244. }
  245. .w-514{
  246. width: 514rpx;
  247. }
  248. .w410{
  249. width: 410rpx;
  250. }
  251. .head-box{
  252. background-color: #fff;
  253. box-shadow: 0rpx 8rpx 8rpx 0rpx rgba(51,51,51,0.06);
  254. image{
  255. width: 100rpx;
  256. height: 100rpx;
  257. border-radius: 8rpx;
  258. margin-right: 18rpx;
  259. }
  260. }
  261. .sy-box{
  262. width: 100%;
  263. height: 60rpx;
  264. background: #F2F2F2;
  265. border-radius: 16rpx 16rpx 16rpx 16rpx;
  266. image{
  267. width: 32rpx;
  268. height: 32rpx;
  269. }
  270. }
  271. .shop-buttom-money{
  272. width: 100%;
  273. height: 140rpx;
  274. background: rgba(255,255,255,0.8);
  275. padding: 20rpx 24rpx;
  276. .shop-buttom-money-1{
  277. width: 100%;
  278. height: 100%;
  279. background: #333333;
  280. border-radius: 200rpx;
  281. box-sizing: border-box;
  282. padding-left: 136rpx;
  283. // padding-right: 32rpx;
  284. position: relative;
  285. image{
  286. position: absolute;
  287. bottom: 0;
  288. left: 8rpx;
  289. width: 128rpx;
  290. height: 128rpx;
  291. }
  292. .shop-buttom-num{
  293. width: 32rpx;
  294. height: 32rpx;
  295. line-height: 32rpx;
  296. background: #FB3D03;
  297. border-radius: 50%;
  298. position: absolute;
  299. top: 36rpx;
  300. left: 82rpx;
  301. }
  302. .shop-buttom-money-2{
  303. width: 200rpx;
  304. height: 100rpx;
  305. line-height: 100rpx;
  306. background: #41ABF5;
  307. border-radius: 0rpx 200rpx 200rpx 0rpx;
  308. }
  309. }
  310. }
  311. .buy-card{
  312. height: 828rpx;
  313. background-color: #fff;
  314. border-radius: 24rpx 24rpx 0rpx 0rpx;
  315. .buy-card-top{
  316. width: 100%;
  317. height: 92rpx;
  318. background: #FCF5DB;
  319. border-radius: 24rpx 24rpx 0rpx 0rpx;
  320. }
  321. .buy-card-item{
  322. width: 100%;
  323. height: 176rpx;
  324. margin-bottom: 32rpx;
  325. image{
  326. width: 152rpx;
  327. height: 152rpx;
  328. border-radius: 12rpx;
  329. margin-right: 20rpx;
  330. }
  331. }
  332. }
  333. }
  334. </style>