作者 lihongjuan

1

... ... @@ -772,7 +772,13 @@
line-height: 88rpx;
border-radius: 10rpx;
}
.behuiyuanbtn{
width:486rpx;
}
.surezhifu{
color:#C29445;
font-size: 32rpx;
}
/* 优惠券使用规则 */
.couponrule {
width: 540rpx;
... ...
... ... @@ -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,32 +178,41 @@
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){
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
})
... ... @@ -211,38 +220,71 @@
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(){
delgood() {
let that = this;
console.log(that.cartid)
uni.showModal({
title: '提示',
content: '是否删除该商品',
success: function (res) {
success: function(res) {
if (res.confirm) {
var url = 'car/batch_delete';
var params = {
car_ids:that.cartid.join(",")
car_ids: that.cartid.join(",")
}
console.log(params)
app.post(url, params).then((res) => {
console.log(res);
uni.showToast({
title:'删除成功',
icon:"none"
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"
})
that.getcartlist()
... ... @@ -274,35 +316,48 @@
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){
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.data1 = that.data1;
}
// 面坊商品
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)
// 积分商品
if (that.data3.length != 0) {
that.data3.forEach(function(value, index, array) {
value.sel = false
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)
... ... @@ -326,7 +381,11 @@
obj.spec_sku_id=item.spec_sku_id;
obj.number=item.number;
console.log('34898348',obj);
that.data.push(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;
... ... @@ -343,6 +402,8 @@
newcartid.splice(index,1)
}
})
that.selall=false;
that.seldelall=false
}
that.data=that.data;
... ... @@ -359,12 +420,17 @@
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)
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;
... ... @@ -379,6 +445,8 @@
newcartid.splice(index,1)
}
})
that.selall=false;
that.seldelall=false
}
}
})
... ... @@ -393,19 +461,23 @@
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)
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.store_goods.price * 100 / 100 * value.number;
... ... @@ -420,42 +492,50 @@
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)
}
},
// 选择全部购物车
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)
... ... @@ -465,20 +545,20 @@
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,29 +698,31 @@
})
},
// 去结算
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) => {
... ... @@ -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;
... ...
... ... @@ -20,7 +20,7 @@
</view>
<view class="sureshop sureshopk">
<!-- 店铺商品 -->
<view class="bigbox" v-if="goodinfo.data3[0].goods!=undefined">
<view class="bigbox" v-if="goodinfo.data3.length!=0">
<view class="sureorderbox flexone">
<view class="sureimg">
<image src="../../static/nearshop.png" mode=""></image>
... ... @@ -252,66 +252,75 @@
</view>
</view>
<view class="huiyuanbot boxsizing">
<view class="behuiyuanbtn">确认支付</view>
<view class="huiyuanbot boxsizing flextwo">
<view class="surezhifu">总计:{{goodinfo.total}}</view>
<view class="behuiyuanbtn behuiyuanbtnk" @click="surepay">确认支付</view>
</view>
<!-- 购买弹层 -->
<view class="register" @click="hidebuy" v-if="buyshow">
<view class="buywrap boxsizing">
<view class="buyname">订单总额</view>
<view class="buymoney">3600</view>
<view class="buymoney">{{goodinfo.total}}</view>
<view class='buybox'>
<view class="buyitem boxsizing flextwo">
<view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="1">
<view class="buyitemleft flexone">
<view class="buyleftimg">
<image src="../../static/zhifubao.png" mode=""></image>
<view class="buyleftimg" >
<image src="../../static/weixin.png" mode=""></image>
</view>
<view class="buyitemname">支付宝</view>
<view class="buyitemname">微信支付</view>
</view>
<view class="selimg">
<image src="../../static/selactive.png" mode=""></image>
<view class="selimg" >
<image src="../../static/selactive.png" mode="" v-if="pay_type==1"></image>
<image src="../../static/active.png" mode="" v-else></image>
</view>
</view>
<view class="buyitem boxsizing flextwo">
<view class="buyitemleft flexone">
<view class="buyleftimg">
<image src="../../static/weixin.png" mode=""></image>
<image src="../../static/zhifubao.png" mode=""></image>
</view>
<view class="buyitemname">微信支付</view>
<view class="buyitemname">支付宝</view>
</view>
<view class="selimg">
<image src="../../static/selactive.png" mode=""></image>
<view class="selimg" @click.stop="paytype" :data-id="2">
<image src="../../static/selactive.png" mode="" v-if="pay_type==2"></image>
<image src="../../static/active.png" mode="" v-else></image>
</view>
</view>
<view class="buyitem boxsizing flextwo">
<view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="3">
<view class="buyitemleft flexone">
<view class="buyleftimg">
<image src="../../static/yue.png" mode=""></image>
<view class="buyleftimg" >
<image src="../../static/yue.png" mode="" ></image>
</view>
<view class="buyitemname">余额支付</view>
</view>
<view class="selimg">
<image src="../../static/selactive.png" mode=""></image>
<view class="selimg" >
<image src="../../static/selactive.png" mode="" v-if="pay_type==3"></image>
<image src="../../static/active.png" mode="" v-else></image>
</view>
</view>
<view class="buyitem boxsizing flextwo">
<view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="4">
<view class="buyitemleft flexone">
<view class="buyleftimg">
<image src="../../static/baitiao.png" mode=""></image>
</view>
<view class="buyitemname">白条支付</view>
<image src="../../static/baitiao.png" mode="" ></image>
</view>
<view class="selimg">
<image src="../../static/selactive.png" mode=""></image>
<view class="buyitemname">赊吧支付</view>
</view>
<view class="selimg" >
<image src="../../static/selactive.png" mode="" v-if="pay_type==4"></image>
<image src="../../static/active.png" mode="" v-else></image>
</view>
</view>
<view class="flextwo">
<view class="totalmoney">{{goodinfo.total}}</view>
<view class="buybtn btnk">确认支付(¥2560.00)</view>
</view>
<view class="buybtn btnk" @click="paynow">确认支付(¥{{goodinfo.total}})</view>
</view>
</view>
<!-- 优惠券使用规则 -->
... ... @@ -381,6 +390,8 @@
name:'上门自提'
}],
goodpeiname:'请选择配送方式',
pay_type:-1,
user_ticket_id:''
... ... @@ -398,6 +409,11 @@
},
methods: {
// 选择支付方式
paytype(e){
this.pay_type=e.currentTarget.dataset.id
},
// 面访商品配送方式
bindmianChange(e){
this.mianpeiname=this.servicearr[e.target.value].name;
... ... @@ -430,17 +446,21 @@
},
// 面坊商品备注
entermianfangrmark(){
this.remark1=e.detail.value
entermianfangrmark(e){
console.log(e)
this.remark1=e.detail.value;
console.log(this.remark1)
},
// 店铺商品备注
entershopmessage(e){
this.seldata.forEach(function(value,index,array){
if(value.type==3){
value.remark=e.detail.value
}
})
this.seldata=this.this.seldata;
console.log(this.seldata)
},
// 积分商品备注
enterjifenremark(){
... ... @@ -487,17 +507,63 @@
console.log(err)
})
},
//确认支付
surepay(){
this.buyshow=true
},
hidebuy(){
this.buyshow=false
},
// 确认支付
paynow(){
let that = this;
// if(that.data.length==0){
// uni.showToast({
// title:'请选择商品',
// icon:'none'
// })
// return false
// }
var url = 'order/create_order';
var params = {
data: JSON.stringify(that.seldata),
user_ticket_id:that.user_ticket_id,
postage_type1:that.postage_type1,
postage_type2:that.postage_type2,
score:that.jifen,
remark1:that.remark1,
remark2:that.remark2,
pay_type:that.pay_type
}
console.log(that.seldata)
console.log(params)
app.post(url, params,"post").then((res) => {
console.log(res);
uni.navigateTo({
url:'/pages/nearshop/sureorder'
})
}).catch((err) => {
console.log(err)
})
}
},
onShow() {
console.log(uni.getStorageSync("addressitem"))
if(uni.getStorageSync("addressitem")!=''){
this.addressitem = uni.getStorageSync("addressitem");
}
if(uni.getStorageSync("addressitem")!=''){
if(uni.getStorageSync("couponitem")!=''){
let couponitem = uni.getStorageSync("couponitem");
this.couponname=couponitem.name
console.log(couponitem)
this.couponname=couponitem.name;
console.log(this.couponname)
this.user_ticket_id=couponitem.id
}
console.log(this.addressitem)
... ... @@ -519,6 +585,8 @@
}
.btnk{
width:200prx;
}
.buywrap{
z-index:999
}
</style>
... ...