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 @@ + + + + + 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 @@ + + + + + \ 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 @@ + + + + + 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 || '暂无可选规格'}} - + + + 产品详情 + + - - - - 产品简介 - - + - + - - - - -