diff --git a/components/cartData.vue b/components/cartData.vue index f8a5837..186a7e0 100644 --- a/components/cartData.vue +++ b/components/cartData.vue @@ -8,12 +8,12 @@ - + 全选 - + 清空 @@ -23,25 +23,24 @@ - + - + - {{ item.good_name }} - {{ item.Specifications_name }} + {{ item.product.title }} + {{ item.sku.sku_name }} - ¥ {{item.Specifications_money/100}} + ¥ {{item.sku.price/100}} - {{item.num}} + - @@ -50,7 +49,10 @@ + + + @@ -137,7 +139,7 @@ this.cartData = data this.setAllSelect() } else { - this.Post({},'/api/shopping/getShoppingList').then(res => { + this.Post({},'/api/cart/get_list').then(res => { if (res) { this.cartData = (res.data || []).map(v=>{return {...v, isSelected:selectedData.includes(v.specifications_id)}}) this.setAllSelect() @@ -166,13 +168,13 @@ }, clearAllGoods(){ - let _this = this - Promise.all(this.cartData.map(v=>{ - return _this.Post({s_id: v.id},'/api/shopping/delShopping') - })).finally(res =>{ - this.cartData = [] - this.setAllSelect() - }) + let ids = this.cartData.map(v=>v.sku.id) + if (ids.length>0) { + this.Post({sku_id:ids.join(',')},'/api/cart/del_sku').then(res=>{ + this.cartData = [] + this.setAllSelect() + }) + } }, setAllSelect() { let goods = this.cartData @@ -188,13 +190,13 @@ addBuyNum(item, num,index){ if (num == -1 && item.num == 1) { - this.Post({s_id: item.id},'/api/shopping/delShopping').then(res =>{ + this.Post({sku_id: item.id, num: 0},'/api/cart/del_sku').then(res =>{ this.cartData.splice(index,1) this.setAllSelect() }) } else { let numData = item.num + num - this.Post({s_id: item.id, num: numData},'/api/shopping/updateShopping').then(res =>{ + this.Post({sku_id: item.id, num: numData},'/api/cart/update_sku').then(res =>{ item.num += num this.setAllSelect() }) @@ -205,7 +207,7 @@ let selectedGoods = this.cartData.filter(v=>v.isSelected) let totalPrice = 0 selectedGoods.forEach(v=>{ - totalPrice += v.Specifications_money/100 * v.num + totalPrice += v.sku.price/100 * v.num }) totalPrice = totalPrice.toFixed(2) console.log(totalPrice) @@ -227,6 +229,8 @@ }) return } + return + // todo let orderData = this.cartData.filter(v=>v.isSelected).map(v=>{ return { goodsInfo: { @@ -245,17 +249,7 @@ }) - let orderInfo = { - is_post: 1, // 购物车都是邮寄 - goods: orderData, - post: 0 - } - uni.setStorageSync('teChanOrder', JSON.stringify(orderInfo)); //规格 - // uni.setStorageSync('teChanInfo', JSON.stringify(this.info)); //商品 - uni.navigateTo({ - url: '/subPackages/techan/order' - }); }, }, @@ -275,7 +269,6 @@ flex-direction: column; background-color: white; height: 933rpx; - padding-bottom: 184rpx; border-radius: 20rpx 20rpx 0rpx 0rpx; display: flex; flex-direction: column; @@ -316,7 +309,7 @@ flex: 1; height: 10rpx; overflow-y: auto; - padding:0 26rpx 26rpx; + padding:0 26rpx 0rpx; .content-item{ margin-bottom: 48rpx; @@ -438,7 +431,7 @@ .ctrl { width: 47rpx; height: 47rpx; - background: #515150; + background: #6A8A2D; border-radius: 50%; font-family: PingFang SC; font-weight: 400; diff --git a/pages.json b/pages.json index d12c115..160160b 100644 --- a/pages.json +++ b/pages.json @@ -89,6 +89,24 @@ "navigationBarTitleText" : "选择自提点" } }, + { + "path": "food/index", + "style": { + "navigationBarTitleText" : "农家烟火" + } + }, + { + "path": "food/detail", + "style": { + "navigationBarTitleText" : "详情" + } + }, + { + "path": "food/order", + "style": { + "navigationBarTitleText" : "订单填写" + } + }, { "path" : "line/index", diff --git a/static/js/CommonFunction.js b/static/js/CommonFunction.js index dd27cf0..854aadd 100644 --- a/static/js/CommonFunction.js +++ b/static/js/CommonFunction.js @@ -237,4 +237,11 @@ Vue.prototype.gotoDetailByType = item => { } console.log(url) Vue.prototype.gotoPath(url) +} + +// 跳转购物车 +Vue.prototype.goCartPage = ()=>{ + uni.switchTab({ + url: "/pages/cart/cart" + }) } \ No newline at end of file diff --git a/subPackages/food/detail.vue b/subPackages/food/detail.vue new file mode 100644 index 0000000..dd3c73d --- /dev/null +++ b/subPackages/food/detail.vue @@ -0,0 +1,835 @@ + + + + + + + + + + + + + + + + + + {{info.price / 100}} + ¥{{info.market_price/100}} + + 已售{{info.sales_number||0}}份 + + + + {{info.title}} + + + {{ key[0] }} + + + {{ data.title }} + {{ data.unit }} + + + + + + + + + + + {{info.scene_name}} + {{info.scene_address}} + + + + 去这里 + + + + + + + 产品特色 + 费用说明 + 预定须知 + + + + 产品特色 + + + + 费用说明 + + + + 预定须知 + + + + + + + + + + + + 客服 + + + + 加入购物车 + 立即购买 + + + + + + + + + + + + + + + + + + + + {{(sku[productIndex].price||0)/100}} + 已选择:{{sku[productIndex].sku_name}} + + + + 规格 + + + + {{botItem.sku_name}} + + + 不可购买 + + + + + + 数量 + + + - + + {{ buyNum }} + + + + + + + + + {{addCart?"加入购物车":"立即购买"}} + + + + + + + + + + diff --git a/subPackages/food/index.vue b/subPackages/food/index.vue new file mode 100644 index 0000000..2dbce99 --- /dev/null +++ b/subPackages/food/index.vue @@ -0,0 +1,150 @@ + + + + + + + + + + + + {{item.title}} + + {{item.display_tags.split(',').join(" | ")}} + + {{item.address}} + + + {{item.price/100}} + + + + + + + + + + + + \ No newline at end of file diff --git a/subPackages/food/order.vue b/subPackages/food/order.vue new file mode 100644 index 0000000..b6fd587 --- /dev/null +++ b/subPackages/food/order.vue @@ -0,0 +1,669 @@ + + + + {{ item.pInfo.title }} + + + + {{item.sInfo.sku_name}} + {{item.sInfo.price / 100}} + + - + {{ item.sInfo.buyNum }} + + + + + + 预订须知 > + + + + + + + + 出行人信息 + + + + 联系电话 + + + + + + + + + + + + 优惠券 + + 选择优惠券 + + + + -¥{{coupon.discounts/100}} + -{{coupon.percent}}% + > + + + + + + 合计: + {{ total() }} + + 去支付 + + + + + + + + + {{skuInfo.sku_name}} + + + + + + + + + + + + + + + + diff --git a/subPackages/techan/detail.vue b/subPackages/techan/detail.vue index 8169f11..b1a9c36 100644 --- a/subPackages/techan/detail.vue +++ b/subPackages/techan/detail.vue @@ -10,53 +10,42 @@ - + - + - - - {{ info.price / 100 }} + + + {{ info.price / 100 }} + /份 + 已售{{info.sales_number || 0}}份 + {{ info.title }} + {{ info.subtitle }} {{ item }} - - - - 选择: - - - {{sku[productIndex].sku_name || '暂无可选规格'}} - + + + 产品详情 + + - - - - 产品简介 - - + - + - - - - - 加入购物车 立即购买 - - - - - - - - - - - ¥ - {{paramData.iNum}} - .{{paramData.fNum}} - - - - - - 提交订单 - + + + + + + - - @@ -142,7 +114,7 @@ - + - + + + + + + + {{item.name}} + + + + + + + 展开 + + + - - - {{item.title}} - + + + 综合 - - + + 销量 + + ▼ + ▼ + + + + 价格 + + ▼ + ▼ + + + {{item.title}} + 已售{{item.sales_number}} - - {{item.price/100}} + + {{item.price/100}} + ¥{{item.market_price/100}} + @@ -47,24 +77,24 @@ - + 暂无搜索结果 - + - + - {{item.goods.title}} + {{item.title}} - {{item.goods.money/100}} - {{item.goods.price/100}} + {{item.price/100}} + {{item.market_price/100}} - + + + @@ -72,16 +102,16 @@ - - + + - {{item.goods.title}} + {{item.title}} - {{item.goods.money/100}} - {{item.goods.price/100}} + {{item.price/100}} + {{item.market_price/100}} - + + + @@ -101,7 +131,7 @@ - + @@ -110,15 +140,10 @@ {{paramData.iNum}} .{{paramData.fNum}} - - 明细 - - - - 去结算 + 去下单 @@ -132,23 +157,25 @@ - + - {{(sku[productIndex].money||0)/100}} - 已选择:{{sku[productIndex].title}} + {{(sku[productIndex].price||0)/100}} + 已选择:{{sku[productIndex].sku_name}} - + + + 规格 + - {{botItem.title}} + {{botItem.sku_name}} 不可购买 - @@ -168,10 +195,27 @@ - 加入购物车 + 加入购物车 + + + + + + + + + + + {{item.name}} + + + 收起 ▼ + + + @@ -186,14 +230,8 @@ statusBarHeight: 0, headImg: "https://cgc.js-dyyj.com/uploads/20250513/f8b255f965efcd71b6843e4b72c3f1f3.png", - typeParam: [ - {id: 366, title: '味 | WEI'}, - {id: 46, title: '服 | FU'}, - {id: 47, title: '器 | QI'}, - {id: 48, title: '香 | XIANG'}, - {id: 49, title: '饰 | SHI'}, - {id: 50, title: '艺 | YI'}, - ], + type_pid: 20, + typeParam: [], typeIndex: 0, list:[], finished: false, @@ -209,6 +247,8 @@ searchText: '', searchList: [], searchFinish: false, + + search_type: 0, } }, onLoad(options) { @@ -224,7 +264,8 @@ }, onReady() { this.initRectInfo() - this.getList() + // this.getList() + this.getTypeTags() }, methods: { initRectInfo () { @@ -234,21 +275,46 @@ this.height = sysInfo.statusBarHeight + 40 }, + getTypeTags () { + this.Post({ + pid: this.type_pid + },'/api/product/tag_list').then(res => { + this.typeParam = res.data || [] + + this.getList() + }) + }, + + changeType (item, i) { if (this.typeIndex!== i) { this.typeIndex=i this.finished = false this.list = [] this.getList() + this.showTypes(false) } }, + changeSearchParm(value) { + this.search_type = value + this.finished = false + this.list = [] + this.getList() + }, + // 根据产品分类获取产品列表 getList(){ + let param = {} + if (this.search_type == 1) { param = {order: 'asc',sort:'sales_number'} } + if (this.search_type == 2) { param = {order: 'desc',sort:'sales_number'} } + if (this.search_type == 3) { param = {order: 'asc',sort:'price'} } + if (this.search_type == 4) { param = {order: 'desc',sort:'price'} } this.Post({ tag_id: this.typeParam[this.typeIndex].id, offset: this.list.length, limit: 10, + ...param },'/api/product/get_product_by_tag').then(res => { this.list = [...this.list, ...res.data.list]; if (res.data.list.length < 10) { @@ -304,10 +370,10 @@ this.productIndex = index }, getSpecificationsByGoodsId(goods_id) { - this.Post({goods_id: goods_id},'/api/goods/getSpecificationsByGoodsId' + this.Post({id: goods_id},'/api/product/get_product_detail' ).then(res => { if (res) { - this.sku = res.data; + this.sku = res.data.sku || []; if (!this.sku||this.sku.length<=0) { uni.showToast({ title:'暂无可选规格', @@ -335,40 +401,16 @@ openPop(){ this.$refs.popup.open() }, - order() { - let goods = this.sku[this.productIndex] - - if(goods.is_post!=1) { - uni.showToast({ - title: '此规格不支持加入购物车', - icon: 'none' - }) - return - } - + addToCart() { + let goods = this.trueSku[this.productIndex] goods.buyNum = this.buyNum - let goodsInfo = {goodsInfo:this.currentGoods, skuInfo: goods, isSelected: true} - - this.Post({good_id: this.currentGoods.id, specifications_id: goods.id,num: this.buyNum }, - '/api/shopping/addShopping').then(res => { - if (res) { - let selectedData = [] - try { - selectedData = JSON.parse(uni.getStorageSync('cartDataInfo')); - } catch(e) { - selectedData = [] - } - let currentGoods = selectedData.find(v =>v==goods.id) - if (!currentGoods) { - selectedData.push(goods.id) - } - uni.setStorageSync('cartDataInfo', JSON.stringify(selectedData)); + this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => { + if (res.code == 1) { uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null}) this.closePopup() // this.$refs.cartDataVueRef.openPop() } }); - }, goCartOrder () { this.$refs.cartDataVueRef.goCartOrder() @@ -389,21 +431,28 @@ this.searchFinish = false } this.Post({ - name: this.searchText.trim(), + title: this.searchText.trim(), offset: this.searchList.length, // type: 'pgoods', - limit: 10, - }, '/api/search/search').then(res => { - let resData = (res.data || []).map(v=> {return {id: v.id, goods: v.search_data}}) - console.log(resData) - this.searchList = [...this.searchList, ...resData]; + tag_id: this.type_pid, + limit: 20, + }, '/api/product/get_product_by_tag').then(res => { + this.searchList = [...this.searchList, ...res.data.list]; + console.log(this.searchList, res) this.searchFinish = false - console.log(resData, this.searchList) if (res.data.length<10) { this.searchFinish = true } }) }, + + showTypes(flag) { + if (flag) { + this.$refs.typePopup.open() + } else { + this.$refs.typePopup.close() + } + }, }, onReachBottom() { if (!this.searchFinish) { @@ -429,14 +478,15 @@ align-items: center; padding-left: 10rpx; padding-right: 120px; + background: #EDF5DC; + z-index: 9999999; .input-model{ flex: 1; width: 1rpx; height: 64rpx; - background: #FFFFFF; + background: white; border-radius: 55rpx; - border: 1rpx solid #20898D; margin-left: 12rpx; display: flex; align-items: center; @@ -452,6 +502,16 @@ font-size: 24rpx; color: #030000; } + .search-btn{ + font-weight: 500; + font-size: 29rpx; + color: #6A8A2D; + border-left: 1px solid #CCCCCC; + padding-left: 25rpx; + width: 85rpx; + height: 50%; + line-height: 1; + } } @@ -463,63 +523,116 @@ background: #F8FAFB; } - .topImg { - width: 750rpx; - height: 344rpx; - flex-shrink: 0; + .type-container{ + display: flex; + height: 133rpx; + background: #EDF5DC; + width: 100%; + padding: 8rpx 0; + .type-item{ + height: 120rpx; + width: 130rpx; + flex-shrink: 0; + display: flex; + flex-direction: column; + align-items: center; + justify-content: space-between; + font-weight: 500; + font-size: 23rpx; + color: #111111; + text-align: center; + .img-container{ + width: 80rpx; + height: 80rpx; + padding: 2rpx; + border-radius: 50%; + image{ + width: 100%; + height: 100%; + border-radius: 50%; + } + } + .type-name{ + width: 80rpx; + height: 30rpx; + line-height: 30rpx; + word-break: keep-all; + } + &.active{ + .img-container{ + border: 2rpx solid #6A8A2D; + } + .type-name{ + background: #6A8A2D; + border-radius: 7rpx; + color: #FFFFFF; + } + } + } + } + .more-btn{ + position: absolute; + right: 0; + top: 0; + bottom: 0; + height: 100%; + font-weight: 500; + font-size: 28rpx; + color: #111111; + width: 67rpx; + background: #EDF5DC; + padding: 24rpx 20rpx; } .goods-container{ height: 1rpx; flex: 1; display: flex; - } - - .left-container{ - width: 214rpx; - flex-shrink: 0; - .type-item{ - font-weight: 400; - font-size: 24rpx; + flex-direction: column; + background: #FFFFFF; + .search-container{ + display: flex; + align-items: center; + justify-content: space-between; + font-weight: bold; + font-size: 27rpx; color: #000000; - text-align: center; - width: 216rpx; - height: 120rpx; - line-height: 120rpx; - position: relative; - .active-type-bar{ - position: absolute; - left: 0; - top: 0; - bottom: 0; + height: 107rpx; + flex-shrink: 0; + padding: 0 32rpx; + &>view{ + display: flex; + width: 80rpx; + align-items: center; + justify-content: space-between; height: 100%; - width: 12rpx; - background: #74A5AA; } } - .type-item.active{ - background: linear-gradient( 90deg, rgba(32,137,141,0.4) 0%, rgba(32,137,141,0) 100%); - font-weight: 600; - font-size: 28rpx; + .search-item{ + display: flex; + flex-direction: column; + line-height: 16rpx; + font-size: 20rpx; } } + .right-container{ flex: 1; - width: 1rpx; + width: 100%; + height: 1rpx; background: white; - padding-top: 32rpx; .item { width: 100%; padding:0 32rpx 32rpx 32rpx; display: flex; .item-img { - width: 148rpx; - height: 148rpx; + width: 161rpx; + height: 161rpx; border-radius: 15rpx; flex-shrink: 0; } .content { - height: 148rpx; + height: 161rpx; padding-left: 24rpx; display: flex; flex-direction: column; @@ -537,14 +650,20 @@ justify-content: space-between; align-items: center; .price { - font-size: 40rpx; - color: #FA0000; + font-size: 33.33rpx; + color: #DC2525; font-weight: 400; } .price::before { content: '¥'; font-size: 24rpx; } + .oldPrice{ + font-weight: 500; + font-size: 21rpx; + color: #999999; + text-decoration-line: line-through; + } } } @@ -553,7 +672,7 @@ width: 44rpx; height: 44rpx; color: #FFFFFF; - background: #74A5AA; + background: #6A8A2D; line-height: 44rpx; font-size: 30rpx; text-align: center; @@ -582,7 +701,7 @@ font-family: PingFang SC; font-weight: bold; font-size: 27rpx; - color: #D70000; + color: #DC2525; padding: 0 12rpx; .bottom-price-yuan{ font-size: 40rpx; @@ -608,8 +727,8 @@ .btn-buy { width: 240rpx; height: 78rpx; - background: #74A5AA; - border-radius: 40rpx; + background: #6A8A2D; + border-radius: 11rpx; text-align: center; line-height: 78rpx; font-size: 32rpx; @@ -620,15 +739,14 @@ } -// 规格弹框 -.popup-content { + .popup-content { background-color: white; padding: 0rpx 39rpx 51rpx 39rpx; height: auto; border-radius: 20rpx 20rpx 0 0; .bottom-productImg { display: flex; - margin-bottom: 48rpx; + margin-bottom: 23rpx; } .bottom-productImg img { @@ -644,7 +762,7 @@ .bottom-productPrice { font-size: 40rpx; - color: #C3282E; + color: #FC524B; &:before { content: "¥"; @@ -664,7 +782,7 @@ width: 320rpx; // height: 78rpx; border-radius: 13rpx; - background-color: #EFEFEF; + background-color: #F5F5F5; font-size: 29rpx; font-family: PingFang SC; font-weight: 400; @@ -695,8 +813,10 @@ font-weight: 400; color: #FFFFFF; } + + .botProducts { - background: #74A5AA; + background: #6A8A27; color: #FFFFFF; } @@ -710,7 +830,6 @@ display: flex; align-items: center; justify-content: space-between; - border-top: 1px solid #CCCCCC; } .buy-num .number-btn { @@ -731,6 +850,20 @@ font-size: 46rpx; } + .buy-btn { + width: 670rpx; + height: 78rpx; + text-align: center; + line-height: 78rpx; + background: linear-gradient(90deg, #F84A56, #FF9834); + border-radius: 40rpx; + + font-size: 34rpx; + font-family: PingFangSC; + font-weight: 500; + color: #FFFFFF; + } + .btn-box { width: 750rpx; height: 151rpx; @@ -740,9 +873,23 @@ align-items: center; justify-content: center; } + .sp { + width: 100%; + height: 30rpx; + font-size: 32rpx; + font-family: PingFangSC; + font-weight: 400; + color: #060001; + line-height: 30rpx; + border-top: solid 2rpx #ccc; + margin: 60rpx 0; + padding-top: 30rpx; + } + } + .placeholder-content{ background: white; position: relative; @@ -762,8 +909,8 @@ height: 78rpx; text-align: center; line-height: 78rpx; - background: #74A5AA; - border-radius: 40rpx; + background: #6A8A2D; + border-radius: 11rpx; font-size: 34rpx; font-family: PingFangSC; @@ -817,4 +964,39 @@ } } } + +.typePopup-container{ + .place-area{ + width: 100%; + opacity: 0; + } + .type-container.typedata-container{ + flex-wrap: wrap;background: #EDF5DC;padding: 30rpx 40rpx 0; + width: 100%; + display: flex; + height: auto; + padding-bottom: 30rpx; + .type-item { + margin-bottom: 30rpx; + } + } + .bottom-close{ + width: 100%; + height: 80rpx; + background: #FFFFFF; + font-weight: 500; + font-size: 28rpx; + color: #111111; + line-height: 80rpx; + text-align: center; + } +} + +.triangle-up { + transform: rotate(180deg); + display: inline-block; +} +.active-search-item{ + color: #6A8A2D; +} diff --git a/subPackages/techan/order.vue b/subPackages/techan/order.vue index 548e89f..33e853c 100644 --- a/subPackages/techan/order.vue +++ b/subPackages/techan/order.vue @@ -170,13 +170,8 @@ - - - - - @@ -200,10 +195,7 @@ export default { post: 0, flag: true, - - reserve_name: '', - reserve_idcard: '', - reserve_phone: '', + remark: '', coupon: "", allprice: 0, @@ -460,10 +452,6 @@ export default { uni.showToast({title: '请选择自提点',icon: 'none'}); return; } - - - - } } @@ -563,9 +551,6 @@ export default { this.coupon = res } } - - - } }; diff --git a/subPackages/techan/selfPickUpPoint.vue b/subPackages/techan/selfPickUpPoint.vue index f210a5f..bbf25bb 100644 --- a/subPackages/techan/selfPickUpPoint.vue +++ b/subPackages/techan/selfPickUpPoint.vue @@ -61,13 +61,11 @@ this.pending = true // this.getLocation() let param = { - goods_id: this.goodsId, - offset: this.list.length, - limit: 10, + product_id: this.goodsId, lon: uni.getStorageSync('location').lon || '', lat: uni.getStorageSync('location').lat || '', } - this.Post(param, "/api/extract/getMerchantExtractListByGoodsIdNew").then(res => { + this.Post(param, "/api/product/getDeliverShop").then(res => { if (res) { this.list = [...this.list, ...res.data]; if (res.data.length < 10) { @@ -117,11 +115,6 @@ }, onReachBottom() { - setTimeout(() => { - if (!this.load) { - this.getList() - } - }, 1000); } } diff --git a/subPackages/ticket/detail.vue b/subPackages/ticket/detail.vue index 98c6f0f..01bef10 100644 --- a/subPackages/ticket/detail.vue +++ b/subPackages/ticket/detail.vue @@ -103,11 +103,11 @@ 客服 - 加入购物车 + 加入购物车 - - + @@ -175,7 +175,7 @@ 合计:{{allSeldDate[seldDateIndex].price / 100 || 0}} - + 下一步 @@ -183,6 +183,52 @@ + + + + + + + + + + {{(trueSku[productIndex].price||0)/100}} + 已选择:{{trueSku[productIndex].sku_name}} + + + + 规格 + + + + {{botItem.sku_name}} + + + 不可购买 + + + + + + 数量 + + + - + + {{ buyNum }} + + + + + + + + + 加入购物车 + + + + @@ -193,6 +239,7 @@ export default { data() { return { + cartNum: 0, headImg: null, swiperCurrent: 0, @@ -215,6 +262,10 @@ stratDate:'',endDate: '', selected: [] }, + trueSku: [], + productIndex: 0, + buyNum: 1, + } }, onShow(options) { @@ -235,6 +286,13 @@ this.Post({id: this.id},'/api/scene/detail').then(res => { this.info = res.data this.sku = this.info.product || [] + + let trueSku = [] + this.sku.forEach(v=>{ + trueSku = trueSku.concat(v.sku) + }) + this.trueSku = trueSku + if (this.info.title) { uni.setNavigationBarTitle({ title: this.info.title @@ -453,8 +511,54 @@ this.clickTab(this.allSeldDate[index],index) } }, - - addBuyCard() { + + // 购物车 + getCartList () { + this.Post({},'/api/cart/get_list').then(res=>{ + this.cartNum = (res.data || []).length + }) + }, + + showCartPopup () { + this.$refs.popupCart.open() + }, + closeCartPopup () { + this.$refs.popupCart.close() + }, + changeProduct(item,index) { + if (item.store==0) { + uni.showToast({ + title:"库存不足!", + icon:'none' + }) + return + } + this.productIndex = index + }, + //数量加减 + addNumber() { + this.buyNum += 1; + }, + delNumber() { + if (this.buyNum <= 1) { + return; + } + this.buyNum -= 1; + }, + addToCart () { + let goods = this.trueSku[this.productIndex] + goods.buyNum = this.buyNum + this.Post({sku_id: goods.id,num: this.buyNum },'/api/cart/add_sku').then(res => { + if (res.code == 1) { + uni.$emit("updateDataByConnect", {msgType:'updateCartDataInfo',data:null}) + this.closeCartPopup() + // this.$refs.cartDataVueRef.openPop() + } + }); + }, + //----------------------------- + + order() { let that = this; // 如果是分时,未选择分时 console.log(this.skuInfo) @@ -1004,4 +1108,187 @@ } } + .popup-content { + background-color: white; + height: auto; + border-radius: 20rpx 20rpx 0 0; + + .bottom-productImg { + display: flex; + margin-bottom: 23rpx; + flex-shrink: 0; + } + + .bottom-productImg img { + width: 218rpx; + height: 179rpx; + background: #666666; + border-radius: 13rpx; + } + + .right-content { + margin: 10rpx 0 0 41rpx; + flex: 1; + width: 1rpx; + } + + .bottom-productPrice { + font-size: 40rpx; + color: #FC524B; + + &:before { + content: "¥"; + font-size: 26rpx; + } + } + + .bottom-content { + width: 100%; + font-size: 27rpx; + font-family: PingFang SC; + font-weight: 400; + color: #666666; + } + + .botProduct { + width: 320rpx; + // height: 78rpx; + border-radius: 13rpx; + background-color: #F5F5F5; + font-size: 29rpx; + font-family: PingFang SC; + font-weight: 400; + color: #333333; + line-height: 78rpx; + text-align: center; + margin-bottom: 25rpx; + display: inline-block; + position: relative; + padding: 0 40rpx; + } + .noStore{ + background-color: rgba(239, 239, 239, 1); + color: rgba(153, 153, 153, 1); + } + .noStore-text{ + width: 113rpx; + height: 43rpx; + background: #C0C0C0; + border-radius: 7rpx 0rpx 7rpx 0rpx; + text-align: center; + line-height: 43rpx; + position: absolute; + right: -14rpx; + top: -20rpx; + font-size: 23rpx; + font-family: PingFangSC; + font-weight: 400; + color: #FFFFFF; + } + + + .botProducts { + background: #6A8A27; + color: #FFFFFF; + } + + .buy-num { + font-size: 29rpx; + font-family: PingFang SC; + font-weight: 400; + color: #333333; + padding: 39rpx 0; + display: flex; + align-items: center; + justify-content: space-between; + } + + .buy-num .number-btn { + display: flex; + } + + .buy-num .number-btn view { + display: flex; + justify-content: center; + align-items: center; + width: 69rpx; + height: 69rpx; + border: 1rpx solid #CCCCCC; + border-radius: 7rpx; + } + + .buy-num .number-btn>view text { + font-size: 46rpx; + } + + .buy-btn { + width: 670rpx; + height: 78rpx; + text-align: center; + line-height: 78rpx; + background: linear-gradient(90deg, #F84A56, #FF9834); + border-radius: 40rpx; + + font-size: 34rpx; + font-family: PingFangSC; + font-weight: 500; + color: #FFFFFF; + } + + .btn-box { + width: 750rpx; + height: 151rpx; + background: #FFFFFF; + box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(6, 0, 1, 0.1); + display: flex; + align-items: center; + justify-content: center; + } + + .sp { + width: 100%; + height: 30rpx; + font-size: 32rpx; + font-family: PingFangSC; + font-weight: 400; + color: #060001; + line-height: 30rpx; + border-top: solid 2rpx #ccc; + margin: 32rpx 0 60rpx; + padding-top: 30rpx; + } + .sp-container{ + display: flex; + align-items: center; + justify-content: space-between; + flex-wrap: wrap; + max-height: 400rpx; + overflow-y: auto; + padding-top: 20rpx; + padding-right: 20rpx; + overflow-x: hidden; + } + .sp-bottom-btn{ + width: 750rpx; + height: 151rpx; + background: #FFFFFF; + box-shadow: 0rpx 0rpx 16rpx 0rpx rgba(6, 0, 1, 0.1); + display: flex; + align-items: center; + justify-content: center; + .btn{ + width: 697rpx; + height: 73rpx; + background: #6A8A2D; + border-radius: 11rpx; + font-weight: bold; + font-size: 32rpx; + color: #FFFFFF; + text-align: center; + line-height: 73rpx; + } + } + + } +