|
|
<template>
|
|
|
<view class="content">
|
|
|
<view class="editcart" @click="editcart">{{editsel==true?'编辑':'完成'}}</view>
|
|
|
<view class="editcart" @click="editcart">{{editsel==true?'编辑':'完成'}}</view>
|
|
|
<!-- <view class="editcart" @click="finishedit" v-else>完成</view> -->
|
|
|
|
|
|
|
|
|
<view class="sureshop">
|
|
|
<!-- 店铺商品-->
|
|
|
<view v-if="data1.length!=0">
|
...
|
...
|
@@ -52,7 +52,7 @@ |
|
|
<view class='cartlist'>
|
|
|
<view class="sureorderitem flexone" v-for="(item,index) in data2" :key="index">
|
|
|
<view class="cartselimg" @click="selectcart(item,index)">
|
|
|
|
|
|
|
|
|
<image src="../../static/cartnosel.png" mode="" v-if="item.sel==false"></image>
|
|
|
<image src="../../static/cartsel.png" mode="" v-else></image>
|
|
|
</view>
|
...
|
...
|
@@ -61,13 +61,13 @@ |
|
|
</view>
|
|
|
<view class='shuright'>
|
|
|
<view class="suregoodnamek">
|
|
|
{{item.flour_goods.name}}
|
|
|
{{item.flour_goods.name}}
|
|
|
</view>
|
|
|
<!-- 商品属性 -->
|
|
|
<view v-if="item.flour_goods.spec.length!=0">
|
|
|
<view class="spec" v-for="(item,index) in item.flour_goods.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
|
|
|
</view>
|
|
|
|
|
|
|
|
|
<view class="surebot flextwo">
|
|
|
<view class="saleprice">¥{{item.flour_goods.price}}</view>
|
|
|
<view class="weightnumk flexone">
|
...
|
...
|
@@ -112,7 +112,7 @@ |
|
|
<view v-if="item.score_goods.spec.length!=0">
|
|
|
<view class="spec" v-for="(item,index) in item.score_goods.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
|
|
|
</view>
|
|
|
|
|
|
|
|
|
<view class="surebot flextwo">
|
|
|
<view class="saleprice">¥{{item.score_goods.price}}</view>
|
|
|
<view class="weightnumk flexone">
|
...
|
...
|
@@ -140,7 +140,7 @@ |
|
|
</view>
|
|
|
<view class='jiesuan' @click="jiesuan">去结算({{arr.length}}件)</view>
|
|
|
</view>
|
|
|
|
|
|
|
|
|
<view class="cartbottom flextwo" v-else>
|
|
|
<view class="flexone">
|
|
|
<view class="cartselimg" @click="selshan">
|
...
|
...
|
@@ -149,7 +149,7 @@ |
|
|
</view>
|
|
|
<view class="quanname">全选</view>
|
|
|
</view>
|
|
|
|
|
|
|
|
|
<view class="delgoodname" @click="delgood">删除商品</view>
|
|
|
</view>
|
|
|
</view>
|
...
|
...
|
@@ -165,11 +165,11 @@ |
|
|
data3: [], //积分商品
|
|
|
selall: false,
|
|
|
total: 0,
|
|
|
arr:[],
|
|
|
data:[],
|
|
|
seldelall:false,
|
|
|
cartid:[],
|
|
|
editsel:true
|
|
|
arr: [],
|
|
|
data: [],
|
|
|
seldelall: false,
|
|
|
cartid: [],
|
|
|
editsel: true
|
|
|
}
|
|
|
},
|
|
|
onLoad() {
|
...
|
...
|
@@ -178,84 +178,126 @@ |
|
|
console.log(uni.getStorageSync("token"))
|
|
|
},
|
|
|
methods: {
|
|
|
editcart(){
|
|
|
this.editsel=!this.editsel;
|
|
|
|
|
|
editcart() {
|
|
|
this.editsel = !this.editsel;
|
|
|
this.cartid = [];
|
|
|
this.arr = [],
|
|
|
this.data = [],
|
|
|
this.seldelall = false;
|
|
|
this.selall = false;
|
|
|
this.getcartlist()
|
|
|
},
|
|
|
|
|
|
|
|
|
// 删除商品
|
|
|
selshan(){
|
|
|
let that=this;
|
|
|
this.seldelall=!this.seldelall;
|
|
|
if(this.seldelall==true){
|
|
|
this.data3.forEach(function(value, index, array) {
|
|
|
selshan() {
|
|
|
let that = this;
|
|
|
let newcartid = [];
|
|
|
this.seldelall = !this.seldelall;
|
|
|
if (this.seldelall == true) {
|
|
|
this.data3.forEach(function(value, index, array) {
|
|
|
value.sel = true;
|
|
|
that.$forceUpdate()
|
|
|
newcartid.push(value.id)
|
|
|
|
|
|
newcartid.push(value.id);
|
|
|
that.cartid = newcartid
|
|
|
|
|
|
})
|
|
|
this.data2.forEach(function(value, index, array){
|
|
|
this.data2.forEach(function(value, index, array) {
|
|
|
value.sel = true;
|
|
|
that.$forceUpdate()
|
|
|
newcartid.push(value.id)
|
|
|
|
|
|
newcartid.push(value.id);
|
|
|
that.cartid = newcartid
|
|
|
|
|
|
})
|
|
|
this.data1[0].list.forEach(function(value, index, array){
|
|
|
this.data1[0].list.forEach(function(value, index, array) {
|
|
|
value.sel = true;
|
|
|
that.$forceUpdate()
|
|
|
newcartid.push(value.id)
|
|
|
|
|
|
newcartid.push(value.id);
|
|
|
that.cartid = newcartid
|
|
|
|
|
|
})
|
|
|
|
|
|
|
|
|
} else {
|
|
|
this.data3.forEach(function(value, index, array) {
|
|
|
value.sel = false;
|
|
|
})
|
|
|
this.data2.forEach(function(value, index, array){
|
|
|
value.sel =false
|
|
|
this.data2.forEach(function(value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
this.data1[0].list.forEach(function(value, index, array){
|
|
|
value.sel =false
|
|
|
this.data1[0].list.forEach(function(value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
|
|
|
newcartid=[];
|
|
|
|
|
|
newcartid = [];
|
|
|
}
|
|
|
that.cartid=newcartid;
|
|
|
that.cartid = newcartid;
|
|
|
console.log(that.cartid)
|
|
|
},
|
|
|
|
|
|
delgood(){
|
|
|
let that = this;
|
|
|
console.log(that.cartid)
|
|
|
|
|
|
delgood() {
|
|
|
let that = this;
|
|
|
console.log(that.cartid)
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '是否删除该商品',
|
|
|
success: function(res) {
|
|
|
if (res.confirm) {
|
|
|
|
|
|
var url = 'car/batch_delete';
|
|
|
var params = {
|
|
|
car_ids: that.cartid.join(",")
|
|
|
}
|
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
uni.showToast({
|
|
|
title: '删除成功',
|
|
|
icon: "none"
|
|
|
})
|
|
|
|
|
|
that.getcartlist()
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
} else if (res.cancel) {
|
|
|
console.log('用户点击取消');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
},
|
|
|
delgood() {
|
|
|
let that = this;
|
|
|
console.log(that.cartid)
|
|
|
uni.showModal({
|
|
|
title: '提示',
|
|
|
content: '是否删除该商品',
|
|
|
success: function (res) {
|
|
|
if (res.confirm) {
|
|
|
|
|
|
var url = 'car/batch_delete';
|
|
|
var params = {
|
|
|
car_ids:that.cartid.join(",")
|
|
|
}
|
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
uni.showToast({
|
|
|
title:'删除成功',
|
|
|
icon:"none"
|
|
|
title: '提示',
|
|
|
content: '是否删除该商品',
|
|
|
success: function(res) {
|
|
|
if (res.confirm) {
|
|
|
|
|
|
var url = 'car/batch_delete';
|
|
|
var params = {
|
|
|
car_ids: that.cartid.join(",")
|
|
|
}
|
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
uni.showToast({
|
|
|
title: '删除成功',
|
|
|
icon: "none"
|
|
|
})
|
|
|
|
|
|
that.getcartlist()
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
|
|
|
that.getcartlist()
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
} else if (res.cancel) {
|
|
|
console.log('用户点击取消');
|
|
|
}
|
|
|
}
|
|
|
} else if (res.cancel) {
|
|
|
console.log('用户点击取消');
|
|
|
}
|
|
|
}
|
|
|
});
|
|
|
|
|
|
|
|
|
},
|
|
|
// 积分商品
|
|
|
jifenshop() {
|
...
|
...
|
@@ -274,211 +316,249 @@ |
|
|
getcartlist() {
|
|
|
let that = this;
|
|
|
var url = 'car/get_all';
|
|
|
var params = {
|
|
|
}
|
|
|
var params = {}
|
|
|
console.log(params)
|
|
|
app.post(url, params).then((res) => {
|
|
|
console.log(res);
|
|
|
that.data1 = res.data.data.data3;
|
|
|
that.data2 = res.data.data.data1;
|
|
|
that.data3 = res.data.data.data2;
|
|
|
let newlenarr = []
|
|
|
// 店铺商品
|
|
|
that.data1[0].list.forEach(function(value,index,array){
|
|
|
value.sel = false;
|
|
|
})
|
|
|
that.data1=that.data1;
|
|
|
if (that.data1.length != 0) {
|
|
|
that.data1[0].list.forEach(function(value, index, array) {
|
|
|
value.sel = false;
|
|
|
newlenarr.push(value)
|
|
|
})
|
|
|
that.data1 = that.data1;
|
|
|
}
|
|
|
|
|
|
|
|
|
// 面坊商品
|
|
|
that.data2.forEach(function(value, index, array) {
|
|
|
value.sel = false;
|
|
|
})
|
|
|
that.data2 = that.data2;
|
|
|
if (that.data2.length != 0) {
|
|
|
that.data2.forEach(function(value, index, array) {
|
|
|
value.sel = false;
|
|
|
newlenarr.push(value)
|
|
|
})
|
|
|
that.data2 = that.data2;
|
|
|
}
|
|
|
|
|
|
console.log('738932893', that.data2)
|
|
|
// 积分商品
|
|
|
that.data3.forEach(function(value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
that.data3 = that.data3;
|
|
|
if (that.data3.length != 0) {
|
|
|
that.data3.forEach(function(value, index, array) {
|
|
|
value.sel = false;
|
|
|
newlenarr.push(value)
|
|
|
})
|
|
|
that.data3 = that.data3;
|
|
|
}
|
|
|
this.lenarr = newlenarr
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
})
|
|
|
},
|
|
|
|
|
|
//选择购物车
|
|
|
selectcart(item, index) {
|
|
|
console.log(item, index)
|
|
|
let that = this;
|
|
|
let newcartid=[]
|
|
|
let obj={}
|
|
|
if (item.type == 2) {
|
|
|
that.data3.forEach(function(value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
value.sel = !value.sel;
|
|
|
that.$forceUpdate()
|
|
|
if (value.sel == true) {
|
|
|
that.arr.push(1)
|
|
|
that.total = that.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number;
|
|
|
newcartid.push(value.id);
|
|
|
console.log(3838944900)
|
|
|
console.log(newcartid);
|
|
|
that.cartid=newcartid
|
|
|
obj.type=item.type;
|
|
|
obj.goods_id=item.goods_id;
|
|
|
obj.spec_sku_id=item.spec_sku_id;
|
|
|
obj.number=item.number;
|
|
|
console.log('34898348',obj);
|
|
|
that.data.push(obj)
|
|
|
} else {
|
|
|
that.arr.splice(0,1)
|
|
|
that.total = that.total * 100 / 100 - value.score_goods.price * 100 / 100 * value.number;
|
|
|
that.data.forEach(function(value,index,array){
|
|
|
console.log(value.goods_id);
|
|
|
console.log(item.goods_id)
|
|
|
if(item.goods_id==value.goods_id){
|
|
|
console.log(34349349043)
|
|
|
that.data.splice(index,1)
|
|
|
//选择购物车
|
|
|
selectcart(item, index) {
|
|
|
console.log(item, index)
|
|
|
let that = this;
|
|
|
let newcartid=[]
|
|
|
let obj={}
|
|
|
if (item.type == 2) {
|
|
|
that.data3.forEach(function(value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
value.sel = !value.sel;
|
|
|
that.$forceUpdate()
|
|
|
if (value.sel == true) {
|
|
|
that.arr.push(1)
|
|
|
that.total = that.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number;
|
|
|
newcartid.push(value.id);
|
|
|
console.log(3838944900)
|
|
|
console.log(newcartid);
|
|
|
that.cartid=newcartid
|
|
|
obj.type=item.type;
|
|
|
obj.goods_id=item.goods_id;
|
|
|
obj.spec_sku_id=item.spec_sku_id;
|
|
|
obj.number=item.number;
|
|
|
console.log('34898348',obj);
|
|
|
that.data.push(obj);
|
|
|
if(that.cartid.length==that.lenarr.length){
|
|
|
that.selall=true;
|
|
|
that.seldelall=true
|
|
|
}
|
|
|
} else {
|
|
|
that.arr.splice(0,1)
|
|
|
that.total = that.total * 100 / 100 - value.score_goods.price * 100 / 100 * value.number;
|
|
|
that.data.forEach(function(value,index,array){
|
|
|
console.log(value.goods_id);
|
|
|
console.log(item.goods_id)
|
|
|
if(item.goods_id==value.goods_id){
|
|
|
console.log(34349349043)
|
|
|
that.data.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
newcartid.forEach(function(value,index,array){
|
|
|
if(value.id==item.id){
|
|
|
newcartid.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
that.selall=false;
|
|
|
that.seldelall=false
|
|
|
}
|
|
|
})
|
|
|
newcartid.forEach(function(value,index,array){
|
|
|
if(value.id==item.id){
|
|
|
newcartid.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
that.data=that.data;
|
|
|
|
|
|
}
|
|
|
})
|
|
|
that.data3 = that.data3
|
|
|
} else if (item.type == 1) {
|
|
|
|
|
|
that.data2.forEach(function(value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
value.sel = !value.sel;
|
|
|
that.data=that.data;
|
|
|
|
|
|
}
|
|
|
})
|
|
|
that.data3 = that.data3
|
|
|
} else if (item.type == 1) {
|
|
|
|
|
|
that.$forceUpdate()
|
|
|
if (value.sel == true) {
|
|
|
that.arr.push(1);
|
|
|
newcartid.push(value.id);
|
|
|
that.total = that.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;
|
|
|
obj.type=item.type;
|
|
|
obj.goods_id=item.goods_id;
|
|
|
obj.spec_sku_id=item.spec_sku_id;
|
|
|
obj.number=item.number;
|
|
|
that.data.push(obj)
|
|
|
|
|
|
} else {
|
|
|
that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * value.number;
|
|
|
that.arr.splice(0,1);
|
|
|
that.data.forEach(function(value,index,array){
|
|
|
if(item.goods_id==value.goods_id){
|
|
|
that.data.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
newcartid.forEach(function(value,index,array){
|
|
|
if(value.id==item.id){
|
|
|
newcartid.splice(index,1)
|
|
|
that.data2.forEach(function(value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
value.sel = !value.sel;
|
|
|
|
|
|
that.$forceUpdate()
|
|
|
if (value.sel == true) {
|
|
|
that.arr.push(1);
|
|
|
newcartid.push(value.id);
|
|
|
that.cartid=newcartid
|
|
|
that.total = that.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;
|
|
|
obj.type=item.type;
|
|
|
obj.goods_id=item.goods_id;
|
|
|
obj.spec_sku_id=item.spec_sku_id;
|
|
|
obj.number=item.number;
|
|
|
that.data.push(obj);
|
|
|
if(that.cartid.length==that.lenarr.length){
|
|
|
that.selall=true;
|
|
|
that.seldelall=true
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * value.number;
|
|
|
that.arr.splice(0,1);
|
|
|
that.data.forEach(function(value,index,array){
|
|
|
if(item.goods_id==value.goods_id){
|
|
|
that.data.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
newcartid.forEach(function(value,index,array){
|
|
|
if(value.id==item.id){
|
|
|
newcartid.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
that.selall=false;
|
|
|
that.seldelall=false
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
}
|
|
|
})
|
|
|
that.data2 = that.data2;
|
|
|
that.data=that.data;
|
|
|
console.log(that.data)
|
|
|
}else if(item.type==3){
|
|
|
|
|
|
console.log('999888',that.data1[0].list)
|
|
|
that.data1[0].list.forEach(function(value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
console.log('383483',value.id)
|
|
|
}
|
|
|
})
|
|
|
that.data2 = that.data2;
|
|
|
that.data=that.data;
|
|
|
console.log(that.data)
|
|
|
}else if(item.type==3){
|
|
|
|
|
|
value.sel = !value.sel;
|
|
|
console.log('999888',that.data1[0].list)
|
|
|
that.data1[0].list.forEach(function(value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
console.log('383483',value.id)
|
|
|
|
|
|
value.sel = !value.sel;
|
|
|
that.$forceUpdate()
|
|
|
console.log(value.sel)
|
|
|
if (value.sel == true) {
|
|
|
console.log(value.sel)
|
|
|
that.arr.push(1);
|
|
|
newcartid.push(item.id);
|
|
|
that.cartid=newcartid;
|
|
|
that.total = that.total * 100 / 100 + value.store_goods.price * 100 / 100 * value.number;
|
|
|
obj.type=item.type;
|
|
|
obj.goods_id=item.goods_id;
|
|
|
obj.spec_sku_id=item.spec_sku_id;
|
|
|
obj.number=item.number;
|
|
|
that.data.push(obj);
|
|
|
if(that.cartid.length==that.lenarr.length){
|
|
|
that.selall=true;
|
|
|
that.seldelall=true
|
|
|
}
|
|
|
|
|
|
that.$forceUpdate()
|
|
|
console.log(value.sel)
|
|
|
if (value.sel == true) {
|
|
|
console.log(value.sel)
|
|
|
that.arr.push(1);
|
|
|
newcartid.push(item.id);
|
|
|
that.total = that.total * 100 / 100 + value.store_goods.price * 100 / 100 * value.number;
|
|
|
obj.type=item.type;
|
|
|
obj.goods_id=item.goods_id;
|
|
|
obj.spec_sku_id=item.spec_sku_id;
|
|
|
obj.number=item.number;
|
|
|
that.data.push(obj)
|
|
|
|
|
|
} else {
|
|
|
that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * value.number;
|
|
|
that.arr.splice(0,1);
|
|
|
that.data.forEach(function(value,index,array){
|
|
|
if(item.goods_id==value.goods_id){
|
|
|
that.data.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
newcartid.forEach(function(value,index,array){
|
|
|
if(value.id==item.id){
|
|
|
newcartid.splice(index,1)
|
|
|
} else {
|
|
|
that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * value.number;
|
|
|
that.arr.splice(0,1);
|
|
|
that.data.forEach(function(value,index,array){
|
|
|
if(item.goods_id==value.goods_id){
|
|
|
that.data.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
newcartid.forEach(function(value,index,array){
|
|
|
if(value.id==item.id){
|
|
|
newcartid.splice(index,1)
|
|
|
}
|
|
|
})
|
|
|
that.selall=false;
|
|
|
that.seldelall=false
|
|
|
|
|
|
}
|
|
|
})
|
|
|
}
|
|
|
})
|
|
|
that.data1 = that.data1;
|
|
|
that.data=that.data;
|
|
|
that.cartid=newcartid;
|
|
|
if(that.cartid.length==that.lenarr.length){
|
|
|
that.selall=true;
|
|
|
that.seldelall=true
|
|
|
}
|
|
|
console.log(that.data);
|
|
|
console.log(that.cartid)
|
|
|
}
|
|
|
})
|
|
|
that.data1 = that.data1;
|
|
|
that.data=that.data;
|
|
|
that.cartid=newcartid;
|
|
|
console.log(that.data);
|
|
|
console.log(that.cartid)
|
|
|
}
|
|
|
|
|
|
},
|
|
|
|
|
|
},
|
|
|
|
|
|
// 选择全部购物车
|
|
|
selectall() {
|
|
|
let that=this;
|
|
|
let that = this;
|
|
|
this.selall = !this.selall;
|
|
|
let newarr=[];
|
|
|
let newtotal=0;
|
|
|
let newcartid=[]
|
|
|
let newarr = [];
|
|
|
let newtotal = 0;
|
|
|
let newcartid = []
|
|
|
if (this.selall == true) {
|
|
|
this.data3.forEach(function(value, index, array) {
|
|
|
value.sel = true;
|
|
|
newarr.push(1);
|
|
|
newtotal=newtotal+value.score_goods.price * 100 / 100 * value.number;
|
|
|
newtotal = newtotal + value.score_goods.price * 100 / 100 * value.number;
|
|
|
newcartid.push(value.id)
|
|
|
// this.total = this.total * 100 / 100 + value.score_goods.price * 100 / 100 * value.number
|
|
|
})
|
|
|
this.data2.forEach(function(value, index, array){
|
|
|
this.data2.forEach(function(value, index, array) {
|
|
|
value.sel = true;
|
|
|
newtotal=newtotal+value.flour_goods.price * 100 / 100 * value.number;
|
|
|
newtotal = newtotal + value.flour_goods.price * 100 / 100 * value.number;
|
|
|
newcartid.push(value.id)
|
|
|
// this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;
|
|
|
newarr.push(1)
|
|
|
})
|
|
|
this.data1[0].list.forEach(function(value, index, array){
|
|
|
this.data1[0].list.forEach(function(value, index, array) {
|
|
|
value.sel = true;
|
|
|
newtotal=newtotal+value.store_goods.price * 100 / 100 * value.number;
|
|
|
newtotal = newtotal + value.store_goods.price * 100 / 100 * value.number;
|
|
|
newcartid.push(value.id)
|
|
|
// this.total = this.total * 100 / 100 + value.flour_goods.price * 100 / 100 * value.number;
|
|
|
newarr.push(1)
|
|
|
})
|
|
|
|
|
|
|
|
|
} else {
|
|
|
this.data3.forEach(function(value, index, array) {
|
|
|
value.sel = false;
|
|
|
})
|
|
|
this.data2.forEach(function(value, index, array){
|
|
|
value.sel =false
|
|
|
this.data2.forEach(function(value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
this.data1[0].list.forEach(function(value, index, array){
|
|
|
value.sel =false
|
|
|
this.data1[0].list.forEach(function(value, index, array) {
|
|
|
value.sel = false
|
|
|
})
|
|
|
newarr=[];
|
|
|
newtotal=0;
|
|
|
newcartid=[];
|
|
|
newarr = [];
|
|
|
newtotal = 0;
|
|
|
newcartid = [];
|
|
|
}
|
|
|
this.data3 = this.data3;
|
|
|
this.total=newtotal;
|
|
|
this.arr=newarr;
|
|
|
this.cartid=newcartid;
|
|
|
this.total = newtotal;
|
|
|
this.arr = newarr;
|
|
|
this.cartid = newcartid;
|
|
|
|
|
|
},
|
|
|
//购物车增加
|
...
|
...
|
@@ -507,9 +587,9 @@ |
|
|
})
|
|
|
that.data2 = that.data2;
|
|
|
|
|
|
}else if(item.type==3){
|
|
|
} else if (item.type == 3) {
|
|
|
that.data1[0].list.forEach(function(value, index, array) {
|
|
|
console.log('3787478',value)
|
|
|
console.log('3787478', value)
|
|
|
if (value.id == item.id) {
|
|
|
console.log(value.id);
|
|
|
console.log(item.id)
|
...
|
...
|
@@ -572,7 +652,7 @@ |
|
|
if (item.sel == true) {
|
|
|
that.total = that.total * 100 / 100 - value.flour_goods.price * 100 / 100 * 1;
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '不能再减少了~',
|
|
|
icon: 'none'
|
...
|
...
|
@@ -581,7 +661,7 @@ |
|
|
}
|
|
|
})
|
|
|
that.data2 = that.data2;
|
|
|
}else if(item.type==3){
|
|
|
} else if (item.type == 3) {
|
|
|
that.data1[0].list.forEach(function(value, index, array) {
|
|
|
if (value.id == item.id) {
|
|
|
if (value.number > 1) {
|
...
|
...
|
@@ -590,7 +670,7 @@ |
|
|
if (item.sel == true) {
|
|
|
that.total = that.total * 100 / 100 - value.store_goods.price * 100 / 100 * 1;
|
|
|
}
|
|
|
}else{
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
title: '不能再减少了~',
|
|
|
icon: 'none'
|
...
|
...
|
@@ -618,34 +698,36 @@ |
|
|
})
|
|
|
},
|
|
|
// 去结算
|
|
|
jiesuan(){
|
|
|
jiesuan() {
|
|
|
let that = this;
|
|
|
if(that.data.length==0){
|
|
|
if (that.data.length == 0) {
|
|
|
uni.showToast({
|
|
|
title:'请选择商品',
|
|
|
icon:'none'
|
|
|
title: '请选择商品',
|
|
|
icon: 'none'
|
|
|
})
|
|
|
return false
|
|
|
}
|
|
|
uni.setStorageSync("addressitem","");
|
|
|
uni.setStorageSync("couponitem","")
|
|
|
var url = 'order/confirm_order';
|
|
|
console.log('获取的参数',that.data)
|
|
|
console.log('获取的参数', that.data)
|
|
|
var params = {
|
|
|
data: JSON.stringify(that.data),
|
|
|
|
|
|
|
|
|
}
|
|
|
console.log(params)
|
|
|
app.post(url, params,"post").then((res) => {
|
|
|
app.post(url, params, "post").then((res) => {
|
|
|
console.log(res);
|
|
|
console.log(res.data.data);
|
|
|
let seldata=JSON.stringify(that.data)
|
|
|
uni.setStorageSync("goodinfo",res.data.data);
|
|
|
let seldata = JSON.stringify(that.data)
|
|
|
uni.setStorageSync("goodinfo", res.data.data);
|
|
|
uni.navigateTo({
|
|
|
url:'/pages/nearshop/sureorder?seldata='+seldata
|
|
|
url: '/pages/nearshop/sureorder?seldata=' + seldata
|
|
|
})
|
|
|
|
|
|
|
|
|
}).catch((err) => {
|
|
|
console.log(err)
|
|
|
|
|
|
|
|
|
})
|
|
|
},
|
|
|
|
...
|
...
|
@@ -660,25 +742,28 @@ |
|
|
page {
|
|
|
background: #F8F6F9;
|
|
|
}
|
|
|
.editcart{
|
|
|
color:#3D454C;
|
|
|
|
|
|
.editcart {
|
|
|
color: #3D454C;
|
|
|
font-size: 28rpx;
|
|
|
width:750rpx;
|
|
|
width: 750rpx;
|
|
|
background: #fff;
|
|
|
text-align: right;
|
|
|
padding: 0 32rpx;
|
|
|
box-sizing: border-box;
|
|
|
}
|
|
|
.quanname{
|
|
|
color:#3D454C;
|
|
|
|
|
|
.quanname {
|
|
|
color: #3D454C;
|
|
|
font-size: 28rpx;
|
|
|
}
|
|
|
.delgoodname{
|
|
|
width:280rpx;
|
|
|
height:88rpx;
|
|
|
background:rgba(194,148,69,1);
|
|
|
border-radius:16rpx;
|
|
|
color:#fff;
|
|
|
|
|
|
.delgoodname {
|
|
|
width: 280rpx;
|
|
|
height: 88rpx;
|
|
|
background: rgba(194, 148, 69, 1);
|
|
|
border-radius: 16rpx;
|
|
|
color: #fff;
|
|
|
font-size: 28rpx;
|
|
|
text-align: center;
|
|
|
line-height: 88rpx;
|
...
|
...
|
@@ -687,10 +772,12 @@ |
|
|
.cartlist {
|
|
|
/* padding-bottom: 120rpx; */
|
|
|
}
|
|
|
.spec{
|
|
|
color:#3D454C;
|
|
|
|
|
|
.spec {
|
|
|
color: #3D454C;
|
|
|
font-size: 28rpx;
|
|
|
}
|
|
|
|
|
|
.cartselimg {
|
|
|
width: 30rpx;
|
|
|
height: 30rpx;
|
...
|
...
|
|