作者 lihongjuan

1

... ... @@ -121,9 +121,11 @@
width: 100%;
height: 100%;
}
.spec {
color: #3D454C;
font-size: 28rpx;
margin-right:10rpx;
}
/* 省份选择 */
... ...
... ... @@ -260,9 +260,6 @@
}
});
},
// 获取购物车气泡
getcartnum(){
let that = this;
... ...
... ... @@ -94,7 +94,7 @@
let id=e.currentTarget.dataset.id;
// type 1 面访商品
uni.navigateTo({
url:'/pages/nearshop/goodtail?id='+id+'&type='+1
url:'/pages/nearshop/goodtail?id='+id+'&type='+3
})
}
... ...
... ... @@ -24,6 +24,9 @@
<view class='shuright'>
<view class="suregoodnamek">{{item.store_goods.name}}
</view>
<view class="flexone" v-if="item.store_goods.spec.length!=0">
<view class="spec" v-for="(item,index) in item.store_goods.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
</view>
<view class="surebot flextwo">
<view class="saleprice">¥{{item.store_goods.price}}</view>
<view class="weightnumk flexone">
... ... @@ -64,7 +67,7 @@
{{item.flour_goods.name}}
</view>
<!-- 商品属性 -->
<view v-if="item.flour_goods.spec.length!=0">
<view class="shubox flexone" 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>
... ... @@ -109,7 +112,7 @@
<view class="suregoodnamek">
{{item.score_goods.name}}
</view>
<view v-if="item.score_goods.spec.length!=0">
<view class="flexone" 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>
... ... @@ -742,6 +745,10 @@
page {
background: #F8F6F9;
}
.sureshop{
padding-bottom: 150rpx;
box-sizing: border-box;
}
.editcart {
color: #3D454C;
... ... @@ -773,10 +780,7 @@
/* padding-bottom: 120rpx; */
}
.spec {
color: #3D454C;
font-size: 28rpx;
}
.cartselimg {
width: 30rpx;
... ...
... ... @@ -3,6 +3,8 @@
<view class="goodtailtop">
<image :src="goodtail.image" mode=""></image>
</view>
<!-- 面坊商品 -->
<view v-if="type==1">
<view class="tailbox boxsizing" v-if="goodtail.is_seckill==2">
... ... @@ -52,30 +54,30 @@
</view>
<!-- 积分商品 -->
<view class="tailbox boxsizing" v-else-if="type==2">
<view class="tailname">
{{goodtail.name}}
</view>
<view class="tailhezi flextwo">
<view class="tailhezileft flexone">
<view class="saleprice">¥{{goodtail.score_goods_spec.goods_price}}</view>
<view class="saleprice">¥{{score_goods_spec.goods_price}}</view>
<!-- <view class="huiyuanprice">会员价:¥{{goodtail.vip_price}}</view> -->
</view>
<view class="heziright flexone">
<view class="heziprice stock">库存:{{goodtail.score_goods_spec.stock_num}}件</view>
<view class="heziprice stock">库存:{{score_goods_spec.stock_num}}件</view>
<view class="heziprice">已售{{goodtail.sales}}件</view>
</view>
</view>
</view>
<!-- 店铺商品 -->
<view class="tailbox boxsizing" v-else-if="type==3">
<view class="tailname">
{{goodtail.name}}
</view>
<view class="tailhezi flextwo">
<view class="tailhezileft flexone">
<view class="saleprice">¥{{goodtail.goods_price}}</view>
<view class="saleprice">¥{{goodtail.price}}</view>
<!-- <view class="huiyuanprice">会员价:¥{{goodtail.vip_price}}</view> -->
</view>
<view class="heziright flexone">
... ... @@ -191,6 +193,10 @@
<view class="shusmallimg" v-if="type==2">
<image :src="goodtail.score_goods_spec.spec_image" mode=""></image>
</view>
<!-- 店铺商品 -->
<view class="shusmallimg" v-if="type==3">
<image :src="goodtail.store_goods_spec.spec_image" mode=""></image>
</view>
</view>
<view class='shuright'>
<view class="shutop flex">
... ... @@ -204,6 +210,7 @@
<view class="saleprice" v-if="type==1">¥{{goodtail.price}}</view>
<!-- 积分商品 -->
<view class="saleprice" v-if="type==2">¥{{goodtail.score_goods_spec.goods_price}}</view>
<view class="saleprice" v-if="type==3">¥{{goodtail.store_goods_spec.goods_price}}</view>
</view>
</view>
<view v-for="(item,parindex) in specarr" :key="parindex">
... ... @@ -247,7 +254,7 @@
sel: 2,
shuwrap: false,
goodid: '',
type: "", //type 1 面访商城 2 积分商城
type: "", //type 1 面访商城 2 积分商城 3店铺商品
goodtail: '',
tapnavactive: '',
selnav: 1,
... ... @@ -267,7 +274,8 @@
total1:'',
total2:'',
total3:'',
carttotal:''
carttotal:'',
score_goods_spec:''
}
},
... ... @@ -275,14 +283,15 @@
console.log(options)
this.goodid = options.id,
this.type = options.type;
console.log('详情类型',this.type)
if (this.type == 1) {
this.getgoodtail();
} else if (this.type == 2) {
this.getjifengoodtail();
} else {
} else if(this.type==3) {
console.log(88877665)
this.getshopgoodtail()
}
// 获取购物车气泡
this.getcartnum()
... ... @@ -298,9 +307,7 @@
}
app.post(url, params).then((res) => {
console.log(res);
this.carttotal=res.data.data.total
this.carttotal=res.data.data.total;
}).catch((err) => {
... ... @@ -384,7 +391,8 @@
}
app.post(url, params).then((res) => {
console.log(res);
that.goodtail = res.data.data
that.goodtail = res.data.data;
}).catch((err) => {
... ... @@ -400,7 +408,9 @@
console.log(params)
app.post(url, params).then((res) => {
console.log(res);
that.goodtail = res.data.data
that.goodtail = res.data.data;
that.score_goods_spec=res.data.data.score_goods_spec
console.log(that.goodtail)
}).catch((err) => {
console.log(err)
... ... @@ -426,7 +436,16 @@
// 加入购物车
addcart() {
this.shuwrap = true;
//type 1店铺商品 2 积分商品 3 面坊商品
if(this.type==3){
this.getshopsepc()
}else if(this.type==2){
this.getspecs();
}else if(this.type==1){
this.getmianfangspec()
}
this.addtype = 1
},
// 立即购买
... ... @@ -435,7 +454,36 @@
this.getspecs();
this.addtype = 2
},
//获取商品规格
// 获取店铺商品规格
getshopsepc(){
let that = this;
var url = 'store_goods/get_spec_sku1';
var params = {
store_goods_id: that.goodid,
}
console.log(params)
app.post(url, params).then((res) => {
console.log(res);
that.specarr = res.data.data;
that.specarr.forEach(function(value, index, array) {
value.selindex = 0;
value.spec_value.forEach(function(valuek, indexk, arrayk) {
if (indexk == 0) {
value.selid = valuek.spec_value_id;
}
valuek.sel = false
})
})
that.specarr = that.specarr;
}).catch((err) => {
console.log(err)
})
},
//获取积分商品规格
getspecs() {
let that = this;
var url = 'score_goods/get_spec_sku1';
... ... @@ -451,7 +499,35 @@
value.spec_value.forEach(function(valuek, indexk, arrayk) {
if (indexk == 0) {
value.selid = valuek.id;
value.selid = valuek.spec_value_id;
}
valuek.sel = false
})
})
that.specarr = that.specarr;
}).catch((err) => {
console.log(err)
})
},
//获取面坊商品规格
getmianfangspec(){
let that = this;
var url = 'flour_goods/get_spec_sku1';
var params = {
flour_goods_id: that.goodid,
}
console.log(params)
app.post(url, params).then((res) => {
console.log(res);
that.specarr = res.data.data;
that.specarr.forEach(function(value, index, array) {
value.selindex = 0;
value.spec_value.forEach(function(valuek, indexk, arrayk) {
if (indexk == 0) {
value.selid = valuek.spec_value_id;
}
valuek.sel = false
})
... ... @@ -466,19 +542,54 @@
// 选择商品规格
selspec(parindex, childindex) {
let newspecarr = this.specarr;
newspecarr[parindex].spec_value[childindex].sel = !newspecarr[parindex].spec_value[childindex].sel;
newspecarr[parindex].selindex = childindex;
newspecarr[parindex].selid = newspecarr[parindex].spec_value[childindex].id
this.arr.push(newspecarr[parindex].spec_value[childindex].id);
newspecarr[parindex].selid = newspecarr[parindex].spec_value[childindex].spec_value_id
this.arr.push(newspecarr[parindex].spec_value[childindex].spec_value_id);
// console.log(this.spec_sku_id)
this.specarr = newspecarr;
// console.log(this.specarr[parindex].spec_value[childindex].sel)
console.log(JSON.stringify(this.specarr))
this.changspec()
if(this.type==3){
this.changeshopsepc()
}else if(this.type==2){
this.changspec();
}else if(this.type==1){
this.changemianspec()
}
},
// 更改店铺商品图片和图片规格
changeshopsepc(){
let that = this;
let newspec_sku_id = []
that.specarr.forEach(function(value, index, array) {
newspec_sku_id.push(value.selid)
})
that.spec_sku_id = newspec_sku_id
var url = 'store_goods/get_spec_sku2';
var params = {
store_goods_id: that.goodid,
spec_sku_id: that.spec_sku_id.join("_")
}
console.log(params)
app.post(url, params).then((res) => {
console.log(res);
if (that.type == 1) {
that.goodtail.flour_goods_spec = res.data.data;
that.goodtail.price = res.data.data.price;
} else if (that.type == 2) {
that.goodtail.score_goods_spec = res.data.data
}
that.goodtail = that.goodtail;
}).catch((err) => {
console.log(err)
})
},
// 更换商品的图片和价格
// 更换积分商品商品的图片和价格
changspec() {
let that = this;
let newspec_sku_id = []
... ... @@ -507,6 +618,36 @@
})
},
//更换面坊商品商品的图片和价格
changemianspec(){
let that = this;
let newspec_sku_id = []
that.specarr.forEach(function(value, index, array) {
newspec_sku_id.push(value.selid)
})
that.spec_sku_id = newspec_sku_id
var url = 'flour_goods/get_spec_sku2';
var params = {
flour_goods_id: that.goodid,
spec_sku_id: that.spec_sku_id.join("_")
}
console.log(params)
app.post(url, params).then((res) => {
console.log(res);
if (that.type == 1) {
that.goodtail.flour_goods_spec = res.data.data;
that.goodtail.price = res.data.data.price;
} else if (that.type == 2) {
that.goodtail.score_goods_spec = res.data.data
}
that.goodtail = that.goodtail;
}).catch((err) => {
console.log(err)
})
},
sure() {
if (this.addtype == 1) {
this.addcartk();
... ... @@ -537,7 +678,6 @@
title: "加入购物车成功",
icon: 'none'
})
setTimeout(function() {
uni.navigateTo({
url: '/pages/nearshop/cartlist'
... ...
<template>
<view class="content">
<view class="sureordertop flextwo" @click="addaddress">
<view class="ordercontent">
<view class="sureordertop flextwo" @click="addaddress" v-if="postage_type3==1||postage_type2==1||postage_type1==1">
<!-- @click="addaddress" -->
<view class="sureordername" v-if="addressitem==''">请选择地址</view>
<view class="addresstop" v-else>
... ... @@ -81,7 +82,6 @@
<view class="deliverymoney">¥{{goodinfo.data3[0].goods_total*100/100+goodinfo.data3[0].postage_price*100/100}}</view>
</view>
</view>
<div class="botbox" v-if="goodinfo.data1.flour_goods!=undefined"></div>
<!-- 面坊商品 -->
<view class="bigbox" v-if="goodinfo.data1.flour_goods!=undefined">
... ... @@ -220,13 +220,13 @@
</view>
<view class="delivery flextwo markcontent">
<view class="deliveryleft flexone">
<view class='jifen'>可用积分抵扣50</view>
<view class='jifen'>可用积分抵扣</view>
<view class="jifenimg youimg">
<image src="../../static/gantan.png" mode=""></image>
</view>
</view>
<view class="deliveryname dikouname">
<input type="text" value="" placeholder="请输入抵扣积分" placeholder-class="dikouinput" @input="enterjifen"/>
<input type="number" value="" placeholder="请输入抵扣积分" placeholder-class="dikouinput" @input="enterjifen"/>
</view>
</view>
<view class="delivery markcontent markcontentk peibox">
... ... @@ -246,13 +246,14 @@
</view>
<view class="delivery peidelivery markcontentk flextwo peiboxk">
<view class="deliveryleft">小计</view>
<view class="deliverymoney">¥{{goodinfo.data2.postage_price*100/100+goodinfo.data2.postage_price*100/100}}</view>
<view class="deliverymoney">¥{{goodinfo.data2.goods_total*100/100+goodinfo.data2.postage_price*100/100}}</view>
</view>
</view>
</view>
</view>
<view class="huiyuanbot boxsizing flextwo">
<view class="huiyuanbot boxsizing flextwo totalbtn">
<view class="surezhifu">总计:{{goodinfo.total}}</view>
<view class="behuiyuanbtn behuiyuanbtnk" @click="surepay">确认支付</view>
</view>
... ... @@ -316,11 +317,8 @@
</view>
</view>
</view>
<view class="buybtn btnk" @click="paynow">确认支付(¥{{goodinfo.total}})</view>
</view>
</view>
<!-- 优惠券使用规则 -->
... ... @@ -344,6 +342,8 @@
export default {
data() {
return {
// 是否显示收货地址
addresstrue:true,
buyshow: false,
couponrule:false,
goodinfo:'',
... ... @@ -359,11 +359,11 @@
name:'上门自提'
},
],
mianpeiname:'请选择配送方式',
mianpeiname:'快递配送',
jifen:'',
couponname:'请选择优惠券',
// 面坊的配送方式
postage_type1:'',
postage_type1:1,
// 积分商品配送方式
jifenservicearr:[{
id:1,
... ... @@ -375,8 +375,8 @@
},
],
jiindex:-1,
postage_type2:'',
jifenpeiname:'请选择配送方式',
postage_type2:1,
jifenpeiname:'快递配送',
//店铺商品
... ... @@ -389,12 +389,12 @@
id:2,
name:'上门自提'
}],
goodpeiname:'请选择配送方式',
goodpeiname:'快递配送',
pay_type:-1,
user_ticket_id:'',
order_id:''
order_id:'',
//判断收货地址是否显示
postage_type3:''
// data1 面坊 data2 积分 data3 店铺
}
},
... ... @@ -403,6 +403,13 @@
this.goodinfo=uni.getStorageSync("goodinfo");
this.seldata=JSON.parse(options.seldata)
this.seldata.forEach(function(value,index,array){
if(value.type==3){
value.postage_type=1;
}
})
this.seldata=this.seldata;
console.log(this.goodinfo)
},
... ... @@ -416,14 +423,17 @@
bindmianChange(e){
this.mianpeiname=this.servicearr[e.target.value].name;
this.mianindex=e.target.value;
this.postage_type1=this.servicearr[e.target.value].id
this.postage_type1=this.servicearr[e.target.value].id;
this.changeorder();
},
// 积分商品的配送方式
bindjiChange(e){
this.jifenpeiname=this.servicearr[e.target.value].name;
this.jiindex=e.target.value;
this.postage_type2=this.servicearr[e.target.value].id
this.postage_type2=this.servicearr[e.target.value].id;
this.changeorder();
},
// 店铺商品的配送方式
bindgoodChange(e){
... ... @@ -431,16 +441,32 @@
console.log(this.goodservicearr)
this.goodpeiname=this.goodservicearr[e.target.value].name;
this.goodindex=e.target.value;
// 店铺商品选择配送方式
this.seldata.forEach(function(value,index,array){
if(value.type==3){
value.postage_type=that.goodservicearr[e.target.value].id;
}
})
this.changeorder();
that.seldata.forEach(function(value,index,array){
if( value.postage_type==1){
that.postage_type3=1;
}
})
},
// 输入积分
enterjifen(e){
this.jifen=e.detail.vlaue
console.log(222222);
console.log(e.detail.value)
this.jifen=e.detail.value;
console.log(this.jifen)
this.changeorder()
},
// 面坊商品备注
entermianfangrmark(e){
... ... @@ -479,34 +505,57 @@
know(){
this.couponrule=false
},
getordertail(){
// 修改价格
changeorder(){
let that = this;
if(that.data.length==0){
uni.showToast({
title:'请选择商品',
icon:'none'
})
return false
}
var url = 'order/confirm_order';
console.log('获取的参数', that.seldata)
var params = {
data: JSON.stringify(that.data),
data: JSON.stringify(that.seldata),
postage_type1:that.postage_type1,
postage_type2:that.postage_type2,
score:that.jifen,
remark1:that.remark1,
remark2:that.remark2,
pay_type:that.pay_type,
user_address_id:that.addressitem.id,
}
console.log(params)
app.post(url, params,"post").then((res) => {
app.post(url, params, "post").then((res) => {
console.log(res);
uni.navigateTo({
url:'/pages/nearshop/sureorder'
})
console.log(res.data.data);
that.goodinfo=res.data.data
// let seldata = JSON.stringify(that.data)
// uni.setStorageSync("goodinfo", res.data.data);
// uni.navigateTo({
// url: '/pages/nearshop/sureorder?seldata=' + seldata
// })
}).catch((err) => {
console.log(err)
uni.showToast({
title:err.msg,
icon:'none'
})
})
},
//确认支付
surepay(){
let that=this;
if(that.postage_type1==1||that.postage_type2==1||that.postage_type3==1){
if(that.addressitem.id==undefined){
uni.showToast({
title:'请选择收货地址',
icon:'none'
})
return false
}
}else{
that.addressitem.id==''
}
this.buyshow=true
},
hidebuy(){
... ... @@ -515,13 +564,9 @@
// 确认支付
paynow(){
let that = this;
// if(that.data.length==0){
// uni.showToast({
// title:'请选择商品',
// icon:'none'
// })
// return false
// }
console.log(that.addressitem.id)
var url = 'order/create_order';
var params = {
data: JSON.stringify(that.seldata),
... ... @@ -534,7 +579,7 @@
pay_type:that.pay_type,
user_address_id:that.addressitem.id
}
console.log(that.seldata)
console.log(that.seldata);
console.log(params)
app.post(url, params,"post").then((res) => {
console.log(res);
... ... @@ -546,6 +591,10 @@
}).catch((err) => {
console.log(err)
uni.showToast({
title:err.msg,
icon:'none'
})
})
},
... ... @@ -565,6 +614,11 @@
title:'支付成功',
icon:'none'
})
setTimeout(function(){
uni.navigateTo({
url:'/pages/usercenter/myOrder'
})
},1500)
}).catch((err) => {
console.log(err)
... ... @@ -600,6 +654,15 @@
page{
background: #F8F6F9;
}
.ordercontent{
padding-bottom: 150rpx;
box-sizing: border-box;
}
.totalbtn{
position: fixed;
bottom:0;
left:0;
}
.totalmoney{
color:#C29445;
font-size: 30rpx;
... ...
... ... @@ -15,7 +15,6 @@
</view>
<view class="navItem" :class="selindx==4?'navactive':''" @click="changeopt" :data-id="4">
待评价
</view>
</view>
<view class="list">
... ... @@ -26,7 +25,6 @@
<text v-if="item.type==1">面坊商品</text>
<text v-if="item.type==2">积分商品</text>
<text v-if="item.type==3">{{item.store.name}}</text>
</view>
<view class="rightT" v-if="item.status==1">待付款</view>
<view class="rightT" v-if="item.status==2">待发货</view>
... ... @@ -36,20 +34,27 @@
<view class="rightT" v-if="item.status==-1">已取消</view>
</view>
<view class="infobox" v-for="(item,index) in item.order_info" :key="index">
<image src="../../static/cai.png" mode="widthFix" class="shop"></image>
<image :src="item.image" mode="widthFix" class="shop"></image>
<view class="info">
<view class="word">{{item.goods_name}}</view>
<view v-if="item.spec.length!=0">
<view class="flexone" v-if="item.spec.length!=0">
<view class="spec" v-for="(item,index) in item.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
</view>
<view class="price">¥{{item.price}}</view>
</view>
</view>
<view class="btnbox">
<view class="btn" style="margin-right: 16rpx;">取消订单</view>
<view class="btn bactive">立即支付</view>
<view class="btnbox" v-if="item.status==1">
<view class="btn" style="margin-right: 16rpx;" @click="cancelorder(item)">取消订单</view>
<view class="btn bactive" @click="payorder(item)">立即支付</view>
</view>
<view class="btnbox" v-if="item.status==3">
<view class="btn bactive">确认收货</view>
</view>
<view class="btnbox" v-if="item.status==4">
<view class="btn bactive">立即评价</view>
</view>
</view>
<!-- <view class="item">
<view class="titlebox">
<view class="leftT">
... ... @@ -132,6 +137,10 @@
},
onLoad(options) {
this.selindx = options.id;
if(options.id==''){
this.selindx=''
}
console.log(this.selindx);
this.getorder()
},
... ... @@ -141,13 +150,65 @@
url: '/pages/usercenter/shopEvaluate'
})
},
// 取消订单
cancelorder(item){
let that=this;
uni.showModal({
title: '提示',
content: '是否取消该订单',
success: function (res) {
if (res.confirm) {
var url = 'order/cancel';
var params = {
order_detail_id:item.id
}
console.log('7766554', params)
app.post(url, params).then((res) => {
console.log(res);
uni.showToast({
title:'取消订单成功',
icon:'none'
})
that.page=1;
that.orderlist=[];
that.getorder();
}).catch((err) => {
console.log(err)
})
} else if (res.cancel) {
console.log('用户点击取消');
}
}
});
},
// 确认订单
payorder(item){
console.log(item)
let that = this;
var url = 'order/pay';
var params = {
// order_id: item.order_id,
order_detail_id:item.id
}
console.log('7766554', params)
app.post(url, params).then((res) => {
console.log(res);
}).catch((err) => {
console.log(err)
})
},
//切换选项
changeopt(e) {
this.selindx = e.currentTarget.dataset.id;
this.page=1;
this.orderlist=[];
this.getorder()
},
// 获取订单列表
getorder() {
... ... @@ -246,7 +307,7 @@
}
.infobox {
height: 204rpx;
/* height: 204rpx; */
display: flex;
align-items: center;
justify-content: space-between;
... ... @@ -258,7 +319,7 @@
.info {
width: 530rpx;
padding: 32rpx 0;
padding: 22rpx 0;
border-bottom: 1px solid #EEEEEE;
box-sizing: border-box;
}
... ... @@ -282,7 +343,7 @@
font-family: PingFangSC-Medium, PingFang SC;
font-weight: 500;
color: rgba(255, 91, 78, 1);
margin-top: 20rpx;
margin-top: 2rpx;
}
.btnbox {
... ...
<template>
<view class="content">
<view class="ordercontent">
<view class="sureordertop flextwo" @click="addaddress" v-if="postage_type3==1||postage_type2==1||postage_type1==1">
<!-- @click="addaddress" -->
<view class="sureordername" v-if="addressitem==''">请选择地址</view>
<view class="addresstop" v-else>
<view class="addressname flexone">
<view class="sureordername">
{{addressitem.name}}
</view>
<view class="sureorderphone">{{addressitem.phone}}</view>
</view>
<view class="addresstitle">
{{addressitem.province_name}}{{addressitem.city_name}}{{addressitem.county_name}}{{addressitem.address}}
</view>
</view>
<view class="yourowk">
<image src="../../static/yourowk.png" mode=""></image>
</view>
</view>
<view class="sureshop sureshopk">
<!-- 店铺商品 -->
<view class="bigbox" v-if="goodinfo.data3.length!=0">
<view class="sureorderbox flexone">
<view class="sureimg">
<image src="../../static/nearshop.png" mode=""></image>
</view>
<view class="sureshopname">{{goodinfo.data3[0].name}}</view>
</view>
<view class="boxbox">
<view class="sureorderitem flex" v-for="(item,index) in goodinfo.data3[0].goods" :key="index">
<view class="sureorderitemleft">
<image :src="item.store_goods_spec.spec_image" mode=""></image>
</view>
<view class='shuright'>
<view class="suregoodnamek">{{item.name}}
</view>
<view v-if="item.spec.length!=0">
<view class="spec" v-for="(item,index) in item.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
</view>
<view class="surebot flexone">
<view class="saleprice">¥{{item.price}}</view>
<view class="detailnum">x{{item.number}}</view>
</view>
</view>
</view>
</view>
<view class="delivery flextwo">
<view class="deliveryleft">配送服务</view>
<view class="deliveryright flexone">
<picker @change="bindgoodChange" :value="goodindex" :range="goodservicearr" range-key="name">
<view class="deliveryname">{{goodpeiname}}</view>
</picker>
<view class='yourow'>
<image src="../../static/yourowk.png" mode=""></image>
</view>
</view>
</view>
<view class="delivery markcontent">
<view class='markname'>店铺备注</view>
<view class="marktext">
<textarea value="" placeholder="选填,给商家留言" @input="entershopmessage" />
</view>
</view>
<view class="delivery markcontent markcontentk peibox">
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>商品金额</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data3[0].goods_total}}</view>
</view>
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>运费</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data3[0].postage_price}}</view>
</view>
</view>
<view class="delivery peidelivery markcontentk flextwo peiboxk">
<view class="deliveryleft">小计</view>
<view class="deliverymoney">¥{{goodinfo.data3[0].goods_total*100/100+goodinfo.data3[0].postage_price*100/100}}</view>
</view>
</view>
<div class="botbox" v-if="goodinfo.data1.flour_goods!=undefined"></div>
<!-- 面坊商品 -->
<view class="bigbox" v-if="goodinfo.data1.flour_goods!=undefined">
<view class="sureorderbox flexone">
<view class="sureimg">
<image src="../../static/nearshop.png" mode=""></image>
</view>
<view class="sureshopname">面坊商品</view>
</view>
<view class="boxbox">
<view class="sureorderitem flex" v-for="(item,index) in goodinfo.data1.flour_goods" :key="index">
<view class="sureorderitemleft">
<!-- <image :src="item.score_goods_spec.spec_image" mode=""></image> -->
</view>
<view class='shuright'>
<view class="suregoodnamek">{{item.name}}
</view>
<view v-if="item.spec.length!=0">
<view class="spec" v-for="(item,index) in item.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
</view>
<view class="surebot flexone">
<view class="saleprice">¥{{item.price}}</view>
<view class="detailnum">x{{item.number}}</view>
</view>
</view>
</view>
</view>
<view class="delivery flextwo">
<view class="deliveryleft">配送服务</view>
<view class="deliveryright flexone">
<picker @change="bindmianChange" :value="mianindex" :range="servicearr" range-key="name">
<view class="deliveryname">{{mianpeiname}}</view>
</picker>
<view class='yourow'>
<image src="../../static/yourowk.png" mode=""></image>
</view>
</view>
</view>
<view class="delivery markcontent">
<view class='markname'>店铺备注</view>
<view class="marktext">
<textarea value="" placeholder="选填,给商家留言" @input="entermianfangrmark"/>
</view>
</view>
<!-- <view class="delivery flextwo markcontent">
<view class="deliveryleft flexone">
<view class='jifen'>可用积分抵扣50</view>
<view class="jifenimg">
<image src="../../static/gantan.png" mode=""></image>
</view>
</view>
<view class="deliveryname">请输入抵扣积分</view>
</view> -->
<view class="delivery flextwo markcontent" @click="selectcoupon">
<view class="deliveryleft flexone">
<view class='jifen'>优惠劵</view>
<view class="jifenimg youimg">
<image src="../../static/gantan.png" mode=""></image>
</view>
</view>
<view class="deliveryname">{{couponname}}</view>
</view>
<view class="delivery markcontent markcontentk peibox">
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>商品金额</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data1.goods_total}}</view>
</view>
<!-- <view class="deliveryitem flextwo">
<view class='deliveryitemname'>积分抵扣</view>
<view class='deliveryitemname moneyright'>¥2600.00</view>
</view> -->
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>优惠券</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data1.discounts}}</view>
</view>
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>运费</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data1.postage_price}}</view>
</view>
</view>
<view class="delivery peidelivery markcontentk flextwo peiboxk">
<view class="deliveryleft">小计</view>
<view class="deliverymoney">¥{{goodinfo.data1.goods_total*100/100+goodinfo.data1.postage_price*100/100}}</view>
</view>
</view>
<div class="botbox" v-if="goodinfo.data2.score_goods!=undefined"></div>
<!-- 积分商品 -->
<view class="bigbox jibox" v-if="goodinfo.data2.score_goods!=undefined">
<view class="sureorderbox flexone">
<view class="sureimg">
<image src="../../static/nearshop.png" mode=""></image>
</view>
<view class="sureshopname">积分商品</view>
</view>
<view class="boxbox">
<view class="sureorderitem flex" v-for="(item,index) in goodinfo.data2.score_goods" :key="index">
<view class="sureorderitemleft">
<image :src="item.score_goods_spec.spec_image" mode=""></image>
</view>
<view class='shuright'>
<view class="suregoodnamek">{{item.name}}
</view>
<view v-if="item.spec.length!=0">
<view class="spec" v-for="(item,index) in item.spec" :key="index">{{item.spec_name}}:{{item.spec_value}}</view>
</view>
<view class="surebot flexone">
<view class="saleprice">¥{{item.price}}</view>
<view class="weightnumk flexone">
<view class="detailnum">x{{item.number}}</view>
</view>
</view>
</view>
</view>
</view>
<view class="delivery flextwo">
<view class="deliveryleft">配送服务</view>
<view class="deliveryright flexone">
<picker @change="bindjiChange" :value="jiindex" :range="jifenservicearr" range-key="name">
<view class="deliveryname">{{jifenpeiname}}</view>
</picker>
<view class='yourow'>
<image src="../../static/yourowk.png" mode=""></image>
</view>
</view>
</view>
<view class="delivery markcontent">
<view class='markname'>店铺备注</view>
<view class="marktext">
<textarea value="" placeholder="选填,给商家留言" @input="enterjifenremark"/>
</view>
</view>
<view class="delivery flextwo markcontent">
<view class="deliveryleft flexone">
<view class='jifen'>可用积分抵扣</view>
<view class="jifenimg youimg">
<image src="../../static/gantan.png" mode=""></image>
</view>
</view>
<view class="deliveryname dikouname">
<input type="number" value="" placeholder="请输入抵扣积分" placeholder-class="dikouinput" @input="enterjifen"/>
</view>
</view>
<view class="delivery markcontent markcontentk peibox">
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>商品金额</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data2.goods_total}}</view>
</view>
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>积分抵扣</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data2.user_score}}</view>
</view>
<view class="deliveryitem flextwo">
<view class='deliveryitemname'>运费</view>
<view class='deliveryitemname moneyright'>¥{{goodinfo.data2.postage_price}}</view>
</view>
</view>
<view class="delivery peidelivery markcontentk flextwo peiboxk">
<view class="deliveryleft">小计</view>
<view class="deliverymoney">¥{{goodinfo.data2.goods_total*100/100+goodinfo.data2.postage_price*100/100}}</view>
</view>
</view>
</view>
</view>
<view class="huiyuanbot boxsizing flextwo totalbtn">
<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">{{goodinfo.total}}</view>
<view class='buybox'>
<view class="buyitem boxsizing flextwo" @click.stop="paytype" :data-id="1">
<view class="buyitemleft flexone">
<view class="buyleftimg" >
<image src="../../static/weixin.png" mode=""></image>
</view>
<view class="buyitemname">微信支付</view>
</view>
<view class="selimg" >
<image src="../../static/selright.png" mode="" v-if="pay_type==1"></image>
<image src="../../static/meisel.png" mode="" v-else></image>
</view>
</view>
<view class="buyitem boxsizing flextwo">
<view class="buyitemleft flexone">
<view class="buyleftimg">
<image src="../../static/zhifubao.png" mode=""></image>
</view>
<view class="buyitemname">支付宝</view>
</view>
<view class="selimg" @click.stop="paytype" :data-id="2">
<image src="../../static/selright.png" mode="" v-if="pay_type==2"></image>
<image src="../../static/meisel.png" mode="" v-else></image>
</view>
</view>
<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>
<view class="buyitemname">余额支付</view>
</view>
<view class="selimg" >
<image src="../../static/selright.png" mode="" v-if="pay_type==3"></image>
<image src="../../static/meisel.png" mode="" v-else></image>
</view>
</view>
<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>
</view>
<view class="selimg" >
<image src="../../static/selright.png" mode="" v-if="pay_type==4"></image>
<image src="../../static/meisel.png" mode="" v-else></image>
</view>
</view>
</view>
<view class="buybtn btnk" @click="paynow">确认支付(¥{{goodinfo.total}})</view>
</view>
</view>
<!-- 优惠券使用规则 -->
<view class='register' v-if="couponrule">
<view class="couponrule">
<view class='coupontitle'>优惠券使用规则</view>
<view class="coupontext">
Lorem ipsum dolor sit amet, consectetur adipiscing elit.
Aenean euismod bibendum laoreet. Proin gravida dolor
sit amet lacus accumsan et viverra justo commodo. Proin sodales pulvinar sic tempor. Sociis natoque penatibus et magnis dis
parturient penatibus et magnis dis parturient
</view>
<view class="know" @click="know">我知道了</view>
</view>
</view>
</view>
</template>
<script>
import app from "../../App.vue";
export default {
data() {
return {
// 是否显示收货地址
addresstrue:true,
buyshow: false,
couponrule:false,
goodinfo:'',
addressitem:'',
addresssel:'请选择地址',
mianindex:-1,
servicearr:[{
id:1,
name:'快递配送'
},
{
id:2,
name:'上门自提'
},
],
mianpeiname:'快递配送',
jifen:'',
couponname:'请选择优惠券',
// 面坊的配送方式
postage_type1:1,
// 积分商品配送方式
jifenservicearr:[{
id:1,
name:'快递配送'
},
{
id:2,
name:'上门自提'
},
],
jiindex:-1,
postage_type2:1,
jifenpeiname:'快递配送',
//店铺商品
goodindex:-1,
goodservicearr:[{
id:1,
name:'快递配送'
},
{
id:2,
name:'上门自提'
}],
goodpeiname:'快递配送',
pay_type:-1,
user_ticket_id:'',
order_id:'',
//判断收货地址是否显示
postage_type3:''
// data1 面坊 data2 积分 data3 店铺
}
},
onLoad(options) {
console.log(38349403)
this.goodinfo=uni.getStorageSync("goodinfo");
this.seldata=JSON.parse(options.seldata)
this.seldata.forEach(function(value,index,array){
if(value.type==3){
value.postage_type=1;
}
})
this.seldata=this.seldata;
console.log(this.goodinfo)
},
methods: {
// 选择支付方式
paytype(e){
this.pay_type=e.currentTarget.dataset.id
},
// 面访商品配送方式
bindmianChange(e){
this.mianpeiname=this.servicearr[e.target.value].name;
this.mianindex=e.target.value;
this.postage_type1=this.servicearr[e.target.value].id;
this.changeorder();
},
// 积分商品的配送方式
bindjiChange(e){
this.jifenpeiname=this.servicearr[e.target.value].name;
this.jiindex=e.target.value;
this.postage_type2=this.servicearr[e.target.value].id;
this.changeorder();
},
// 店铺商品的配送方式
bindgoodChange(e){
let that=this;
console.log(this.goodservicearr)
this.goodpeiname=this.goodservicearr[e.target.value].name;
this.goodindex=e.target.value;
// 店铺商品选择配送方式
this.seldata.forEach(function(value,index,array){
if(value.type==3){
value.postage_type=that.goodservicearr[e.target.value].id;
}
})
this.changeorder();
that.seldata.forEach(function(value,index,array){
if( value.postage_type==1){
that.postage_type3=1;
}
})
},
// 输入积分
enterjifen(e){
console.log(222222);
console.log(e.detail.value)
this.jifen=e.detail.value;
console.log(this.jifen)
this.changeorder()
},
// 面坊商品备注
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(){
this.remark2=e.detail.value
},
// 选择优惠券
selectcoupon(){
uni.navigateTo({
url:'/pages/nearshop/selectcoupon'
})
},
// 添加地址
addaddress(){
console.log(334439090)
uni.navigateTo({
url:"/pages/usercenter/address"
})
},
know(){
this.couponrule=false
},
// 修改价格
changeorder(){
let that = this;
var url = 'order/confirm_order';
console.log('获取的参数', that.seldata)
var params = {
data: JSON.stringify(that.seldata),
postage_type1:that.postage_type1,
postage_type2:that.postage_type2,
score:that.jifen,
remark1:that.remark1,
remark2:that.remark2,
pay_type:that.pay_type,
user_address_id:that.addressitem.id,
}
console.log(params)
app.post(url, params, "post").then((res) => {
console.log(res);
console.log(res.data.data);
that.goodinfo=res.data.data
// let seldata = JSON.stringify(that.data)
// uni.setStorageSync("goodinfo", res.data.data);
// uni.navigateTo({
// url: '/pages/nearshop/sureorder?seldata=' + seldata
// })
}).catch((err) => {
console.log(err)
uni.showToast({
title:err.msg,
icon:'none'
})
})
},
//确认支付
surepay(){
let that=this;
if(that.postage_type1==1||that.postage_type2==1||that.postage_type3==1){
if(that.addressitem.id==undefined){
uni.showToast({
title:'请选择收货地址',
icon:'none'
})
return false
}
}else{
that.addressitem.id==''
}
this.buyshow=true
},
hidebuy(){
this.buyshow=false
},
// 确认支付
paynow(){
let that = this;
console.log(that.addressitem.id)
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,
user_address_id:that.addressitem.id
}
console.log(that.seldata);
console.log(params)
app.post(url, params,"post").then((res) => {
console.log(res);
that.order_id=res.data.data.order_id;
that.paymoney()
// uni.navigateTo({
// url:'/pages/nearshop/sureorder'
// })
}).catch((err) => {
console.log(err)
uni.showToast({
title:err.msg,
icon:'none'
})
})
},
// 支付接口
paymoney(){
let that = this;
var url = 'order/pay';
var params = {
order_id:that.order_id
}
console.log(params)
app.post(url, params,"post").then((res) => {
console.log(res);
uni.showToast({
title:'支付成功',
icon:'none'
})
setTimeout(function(){
uni.navigateTo({
url:'/pages/usercenter/myOrder'
})
},1500)
}).catch((err) => {
console.log(err)
})
},
},
onShow() {
console.log(uni.getStorageSync("addressitem"))
if(uni.getStorageSync("addressitem")!=''){
this.addressitem = uni.getStorageSync("addressitem");
}
if(uni.getStorageSync("couponitem")!=''){
let couponitem = uni.getStorageSync("couponitem");
console.log(couponitem)
this.couponname=couponitem.name;
console.log(this.couponname)
this.user_ticket_id=couponitem.id
}
console.log(this.addressitem)
}
}
</script>
<style>
@import url('../../base/nearshop');
@import url('../../base/homepage');
page{
background: #F8F6F9;
}
.ordercontent{
padding-bottom: 150rpx;
box-sizing: border-box;
}
.totalbtn{
position: fixed;
bottom:0;
left:0;
}
.totalmoney{
color:#C29445;
font-size: 30rpx;
}
.btnk{
width:200prx;
}
.buywrap{
z-index:999
}
</style>
... ...