replace-take.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463
  1. <template>
  2. <view class="replace-take-box iPhone-bottom flex-common-css box-border-box bgc-f">
  3. <view class="nav-box">
  4. <image class="bg-img" src="@/static/img/takeout/dq-bg.png" mode="scaleToFill"></image>
  5. <Nav :leftShow='false' :customNav='true' bgckgroundBox='transparent'>
  6. <template>
  7. <view slot="custom" class="align-items-center">
  8. <uni-icons type="left" size="20" @click="toBack()"></uni-icons>
  9. <view class="w-390 text-overflow-ellipsis-one fs-36 fw-400">{{schoolData.school_name}}</view>
  10. </view>
  11. </template>
  12. </Nav>
  13. <view :class="addressData.id?'bottom-124':''" class="address-box align-items-center box-border-box plr-24" @click="selectFun()">
  14. <view v-if="!addressData.site_id" class="address-1 flex-justify-space align-items-center">
  15. <view class="align-items-center">
  16. <image class="qu-image" src="@/static/img/takeout/qu-icon.png" mode=""></image>
  17. <view class="fw-600 fs-40">请选择站点</view>
  18. </view>
  19. <image class="address-box-right" src="@/static/img/toRight.png" mode=""></image>
  20. </view>
  21. <view v-else class="address-2 flex-justify-space align-items-center">
  22. <view class="display-flex">
  23. <image class="address-img mr-20" :src="addressData.site_logo" mode="scaleToFill"></image>
  24. <view class="">
  25. <view class="w-474 fs-40 fw-600 mb-4">{{addressData.site_name}}</view>
  26. <view class="w-474 fw-400 fs-26 fc-9">{{addressData.site_address}}</view>
  27. </view>
  28. </view>
  29. <image class="address-box-right" src="@/static/img/toRight.png" mode=""></image>
  30. </view>
  31. </view>
  32. </view>
  33. <view class="scroll-view-css list-box box-border-box plr-24">
  34. <view class="mb-32" :class="addressData.id?'h-120':'h-60'"></view>
  35. <view class="list-box-b mb-48">
  36. <view class="fs-36 fw-600 mb-22">快递类型</view>
  37. <view class="list-item flex-justify-space" v-for="(item,i) in list" :key="i">
  38. <image :src="item.serve_image" mode="scaleToFill"></image>
  39. <view class="flex-1">
  40. <view class="fs-32 fw-600 mb-32 ">{{item.serve_name}}</view>
  41. <view class="fs-24 fw-400 mb-32 fc-9">{{item.serve_desc}}</view>
  42. <!-- <view class="fs-24 fw-400 mb-4 fc-9">销量2801</view> -->
  43. <view class="flex-justify-space">
  44. <view class="">
  45. <span class="fw-4 fc-FB3D03 fs-24">¥</span>
  46. <span class="fw-b fc-FB3D03 fs-40">{{item.price}}</span>
  47. <span class="fw-400 fc-9 fs-24">/份</span>
  48. </view>
  49. <view class="display-flex align-items-center">
  50. <view class="right-only-right-red fw-500 text-align-center fs-36 fc-f" @click="redNumber(item)">-</view>
  51. <view class="right-only-right-2 text-align-center fs-28 fw-400">{{item.num}}</view>
  52. <view class="right-only-right-add fw-500 text-align-center fs-36 fc-f" @click="addNumber(item)">+</view>
  53. </view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="">
  59. <view class="fs-36 fw-600 mb-22">取件码({{pickup_code.length}})</view>
  60. <view class="mb-20" v-for="(item,i) in pickup_code" :key="i">
  61. <input class="input-num" v-model="item.code" type="text" placeholder="未输入取件码" placeholder-class="input-p">
  62. </view>
  63. </view>
  64. </view>
  65. <view class="shop-buttom-money box-border-box" @click="openBuyCrad()">
  66. <view class="shop-buttom-money-1 flex-justify-space align-items-center">
  67. <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
  68. <view class="shop-buttom-num fs-24 fc-f text-align-center">{{cardData.total_num}}</view>
  69. <view class="">
  70. <span class="fw-600 fs-24 fc-f">¥</span>
  71. <span class="fw-600 fs-44 fc-f">{{cardData.total_price||0}}</span>
  72. </view>
  73. <view class="shop-buttom-money-2 text-align-center fs-32 fc-f fw-600">去结算</view>
  74. </view>
  75. </view>
  76. <uni-popup ref="popupBuy" type="bottom" style="z-index: 200;">
  77. <view class="buy-card flex-index-css">
  78. <view class="buy-card-top box-border-box plr-32 flex-justify-space align-items-center">
  79. <view class="">
  80. <span class="fs-32 fc-3 mr-12">已选商品</span>
  81. </view>
  82. <view class="fs-28 fw-400 fc-9 align-items-center">
  83. <view class="">
  84. <uni-icons type="trash" size="18" color="#999"></uni-icons>
  85. </view>
  86. <view class="fs-28 fw-400 fc-9" @click="cardAllDel()">清空</view>
  87. </view>
  88. </view>
  89. <view class="scroll-view-css box-border-box p-32">
  90. <view class="buy-card-item display-flex" v-for="(item,i) in 5" :key="i">
  91. <image src="@/static/img/my/bg.png" mode="scaleToFill"></image>
  92. <view class="flex-1">
  93. <view class="w-514 text-overflow-ellipsis-one fs-34 fw-600 mb-12">[畅销款]奥尔1良烤肉牛油拌饭拌饭[畅销款]奥尔1良烤肉牛油拌饭拌饭</view>
  94. <view class="w-514 text-overflow-ellipsis-one fs-24 fw-400 fc-9 mb-18">不辣,加辣</view>
  95. <view class="flex-justify-space">
  96. <view class="">
  97. <span class="fs-24 fc-FB3D03 fw-400">¥</span>
  98. <span class="fs-40 fc-FB3D03 fw-b">3.99</span>
  99. </view>
  100. <view class="display-flex align-items-center">
  101. <view class="right-only-right-red fw-500 text-align-center fs-36 fc-f" >-</view>
  102. <view class="right-only-right-2 text-align-center fs-28 fw-400">0</view>
  103. <view class="right-only-right-add fw-500 text-align-center fs-36 fc-f" >+</view>
  104. </view>
  105. </view>
  106. </view>
  107. </view>
  108. </view>
  109. <view class="shop-buttom-money box-border-box" @click="createOrder()">
  110. <view class="shop-buttom-money-1 flex-justify-space align-items-center">
  111. <image src="@/static/img/takeout/buy-icon.png" mode="scaleToFill"></image>
  112. <view class="shop-buttom-num fs-24 fc-f text-align-center">3</view>
  113. <view class="">
  114. <view class="">
  115. <span class="fw-600 fs-24 fc-f">¥</span>
  116. <span class="fw-600 fs-44 fc-f">19.26</span>
  117. </view>
  118. </view>
  119. <view class="shop-buttom-money-2 text-align-center fs-32 fc-f fw-600">去结算</view>
  120. </view>
  121. </view>
  122. </view>
  123. </uni-popup>
  124. </view>
  125. </template>
  126. <script>
  127. import tools from "@/service/tools";
  128. import {getExpressServe} from '@/api/express.js';
  129. import {setShopIngAdd,setShopIngNumber,setShopIngDel,getShopIngList} from '@/api/shopping.js'
  130. export default {
  131. data(){
  132. return{
  133. schoolData:{
  134. school_id:'',
  135. school_name:'',
  136. },
  137. addressData:{
  138. site_id:'',
  139. site_name:'',
  140. site_address:'',
  141. site_logo:'',
  142. },
  143. list:[],
  144. isAJAX:false,
  145. pickup_code:[],
  146. cardData:{
  147. goods_list:[],
  148. total_num:0,
  149. total_price:0,
  150. },
  151. }
  152. },
  153. onShow() {
  154. this.schoolData.school_id = uni.getStorageSync('school_id');
  155. this.schoolData.school_name = uni.getStorageSync('school_name');
  156. this.addressData.site_id = uni.getStorageSync('site_id');
  157. this.addressData.site_name = uni.getStorageSync('site_name');
  158. this.addressData.site_address = uni.getStorageSync('site_address');
  159. this.addressData.site_logo = uni.getStorageSync('site_logo');
  160. this.getList();
  161. },
  162. methods:{
  163. getList(){
  164. getExpressServe().then((res)=>{
  165. if(res.code === 1){
  166. this.list = res.data;
  167. this.list.forEach((v)=>{
  168. v.num = 0
  169. })
  170. this.getCard();
  171. }
  172. })
  173. },
  174. getCard(){
  175. getShopIngList({type:2}).then((res)=>{
  176. if(res.code === 1){
  177. this.cardData = res.data;
  178. if(this.cardData.total_num > 0){
  179. this.cardData.goods_list.forEach(v=>{
  180. this.list.forEach(t=>{
  181. if(v.goods_id === t.id){
  182. t.num = v.number
  183. }
  184. })
  185. })
  186. for (let i = 0; i < this.cardData.total_num; i++) {
  187. let obj = {code:''};
  188. this.pickup_code.push(obj);
  189. }
  190. console.log(this.pickup_code);
  191. }
  192. }
  193. })
  194. },
  195. toBack(){
  196. tools.leftClick()
  197. },
  198. selectFun(){
  199. uni.navigateTo({
  200. url:'pages-takeout/replace-mod/select-site?site_id=' + this.addressData.site_id
  201. })
  202. },
  203. openBuyCrad(){
  204. console.log(this.pickup_code);
  205. // this.$refs.popupBuy.open()
  206. },
  207. createOrder(){
  208. },
  209. addNumber(item){
  210. if(this.isAJAX){
  211. return
  212. }
  213. this.isAJAX = true;
  214. setShopIngAdd({type:2,goods_id:item.id}).then((res)=>{
  215. if(res.code === 1){
  216. this.isAJAX = false;
  217. item.num += 1;
  218. this.$forceUpdate();
  219. }else{
  220. this.isAJAX = false;
  221. tools.error('添加操作失败')
  222. }
  223. })
  224. },
  225. redNumber(item){
  226. if(item.num > 0){
  227. if(this.isAJAX){
  228. return
  229. }
  230. this.isAJAX = true;
  231. setShopIngNumber({type:2,goods_id:item.id,operation:2}).then((res)=>{
  232. if(res.code === 1){
  233. this.isAJAX = false;
  234. item.num -= 1;
  235. this.$forceUpdate();
  236. }else{
  237. this.isAJAX = false;
  238. tools.error('减少操作失败')
  239. }
  240. })
  241. }else{
  242. tools.error('已无可减少商品')
  243. }
  244. },
  245. cardAllDel(){
  246. },
  247. }
  248. }
  249. </script>
  250. <style scoped lang="scss">
  251. .replace-take-box{
  252. .h-80{
  253. width: 470rpx;
  254. height: 88rpx;
  255. }
  256. .right-only-right-red{
  257. width: 44rpx;
  258. height: 44rpx;
  259. line-height: 40rpx;
  260. border-radius: 12rpx;
  261. border: 1rpx solid #41ABF5;
  262. color: #41ABF5;
  263. }
  264. .right-only-right-add{
  265. width: 44rpx;
  266. height: 44rpx;
  267. line-height: 40rpx;
  268. background: linear-gradient( 117deg, #57CAFF 0%, #41ABF5 100%);
  269. border-radius: 12rpx;
  270. }
  271. .right-only-right-2{
  272. min-width: 50rpx;
  273. }
  274. .w-514{
  275. width: 514rpx;
  276. }
  277. .buy-card{
  278. z-index: 200;
  279. height: 828rpx;
  280. background-color: #fff;
  281. border-radius: 24rpx 24rpx 0rpx 0rpx;
  282. .buy-card-top{
  283. width: 100%;
  284. height: 92rpx;
  285. background: #FCF5DB;
  286. border-radius: 24rpx 24rpx 0rpx 0rpx;
  287. }
  288. .buy-card-item{
  289. width: 100%;
  290. height: 176rpx;
  291. margin-bottom: 32rpx;
  292. image{
  293. width: 152rpx;
  294. height: 152rpx;
  295. border-radius: 12rpx;
  296. margin-right: 20rpx;
  297. }
  298. }
  299. }
  300. .h-120{
  301. height: 120rpx;
  302. }
  303. .h-60{
  304. height: 60rpx;
  305. }
  306. .w-474{
  307. width: 474rpx;
  308. }
  309. .w-390{
  310. width: 390rpx;
  311. margin-left: 38rpx;
  312. }
  313. .nav-box{
  314. height: 490rpx;
  315. position: relative;
  316. .bg-img{
  317. position: absolute;
  318. top: 0;
  319. left: 0;
  320. width: 100%;
  321. height: 490rpx;
  322. // z-index: -1;
  323. }
  324. .bottom-124{
  325. bottom: -124rpx !important;
  326. }
  327. .address-box{
  328. z-index: 100;
  329. position: absolute;
  330. bottom: -64rpx;
  331. left: 24rpx;
  332. box-sizing: border-box;
  333. width: 702rpx;
  334. min-height: 136rpx;
  335. background: linear-gradient( 182deg, #F1F9FF 0%, #FFFFFF 100%);
  336. box-shadow: 0rpx 0rpx 40rpx 0rpx rgba(172,210,235,0.19);
  337. border-radius: 20rpx;
  338. border-image: linear-gradient(167deg, rgba(255, 255, 255, 1), rgba(208, 236, 255, 0.61)) 2 2;
  339. .address-1{
  340. width: 100%;
  341. .qu-image{
  342. width: 40rpx;
  343. height: 49rpx;
  344. margin: 10rpx 10rpx 0 0;
  345. }
  346. }
  347. .address-2{
  348. box-sizing: border-box;
  349. padding:32rpx 0;
  350. }
  351. .address-img{
  352. width: 100rpx;
  353. height: 100rpx;
  354. border-radius: 8rpx;
  355. }
  356. .address-box-right{
  357. width: 32rpx;
  358. height: 32rpx;
  359. }
  360. }
  361. }
  362. .shop-buttom-money{
  363. width: 100%;
  364. height: 140rpx;
  365. background: rgba(255,255,255,0.8);
  366. padding: 20rpx 24rpx;
  367. .shop-buttom-money-1{
  368. width: 100%;
  369. height: 100%;
  370. background: #333333;
  371. border-radius: 200rpx;
  372. box-sizing: border-box;
  373. padding-left: 136rpx;
  374. // padding-right: 32rpx;
  375. position: relative;
  376. image{
  377. position: absolute;
  378. bottom: 0;
  379. left: 8rpx;
  380. width: 128rpx;
  381. height: 128rpx;
  382. }
  383. .shop-buttom-num{
  384. width: 32rpx;
  385. height: 32rpx;
  386. line-height: 32rpx;
  387. background: #FB3D03;
  388. border-radius: 50%;
  389. position: absolute;
  390. top: 36rpx;
  391. left: 82rpx;
  392. }
  393. .shop-buttom-money-2{
  394. width: 200rpx;
  395. height: 100rpx;
  396. line-height: 100rpx;
  397. background: #41ABF5;
  398. border-radius: 0rpx 200rpx 200rpx 0rpx;
  399. }
  400. }
  401. }
  402. .list-box{
  403. .list-box-b{
  404. border-bottom: 1rpx solid #f9f9f9;
  405. }
  406. .list-item{
  407. width: 100%;
  408. min-height: 100rpx;
  409. margin-bottom: 50rpx;
  410. image{
  411. width: 200rpx;
  412. height: 200rpx;
  413. border-radius: 20rpx;
  414. margin-right: 20rpx;
  415. }
  416. }
  417. .input-num{
  418. width: 100%;
  419. height: 92rpx;
  420. box-sizing: border-box;
  421. padding: 0 24rpx;
  422. background: #F6F6F6;
  423. border-radius: 20rpx;
  424. font-size: 32rpx;
  425. }
  426. .input-p{
  427. font-weight: 400;
  428. font-size: 28rpx;
  429. color: #FB3D03;
  430. }
  431. }
  432. }
  433. </style>