|
|
@@ -16,37 +16,36 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<!-- 加购权益列表 --> |
|
|
|
加购权益列表 |
|
|
|
<view class="add_all"> |
|
|
|
<uni-swipe-action> |
|
|
|
<uni-swipe-action-item |
|
|
|
class="del_item" |
|
|
|
v-for="(item,index) in state.list" |
|
|
|
:right-options="state.options2" |
|
|
|
:show="item.isOpened" |
|
|
|
:auto-close="false" |
|
|
|
@change="change" |
|
|
|
@click="bindClick(index)" |
|
|
|
> |
|
|
|
<uni-swipe-action-item class="del_item" v-for="(item,index) in state.list" |
|
|
|
:right-options="state.options2" :show="item.isOpened" :auto-close="false" @change="change" |
|
|
|
@click="bindClick(index)"> |
|
|
|
<view class="content-box"> |
|
|
|
<view v-if='item.children' style="display: inline-block;"> |
|
|
|
<image :class="item.isShow?'imageChange':'imageDefault'" @click="changeIsShow(index)" src="../../static/image/icon-back.png" alt="" srcset=""></image> |
|
|
|
<image :class="item.isShow?'imageChange':'imageDefault'" @click="changeIsShow(index)" |
|
|
|
src="../../static/image/icon-back.png" alt="" srcset=""></image> |
|
|
|
</view> |
|
|
|
<text class="content-text" @tap="setOpened">{{item.productName}} |
|
|
|
¥{{item.discountPrice * 0.01}}</text> |
|
|
|
<view v-if="item.isShow" class="children" v-for="(itemChild,index) in item.children" |
|
|
|
:key='index'> |
|
|
|
<view> |
|
|
|
<text>{{itemChild.productName}}</text> <text>{{itemChild.discountPrice * 0.01}}</text> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<text class="content-text" @tap="setOpened">{{item.productName}} ¥{{item.discountPrice * 0.01}}</text> |
|
|
|
<view v-if="item.isShow" class="children" v-for="(itemChild,index) in item.children" :key='index'> |
|
|
|
<view><text>{{itemChild.productName}}</text> <text>{{itemChild.discountPrice * 0.01}}</text></view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</uni-swipe-action-item> |
|
|
|
|
|
|
|
|
|
|
|
</uni-swipe-action> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="value-wrapper"> |
|
|
|
<view class="flex"> |
|
|
|
<view class="title"> 产品金额 </view> |
|
|
|
<view class="value"> |
|
|
|
{{ "¥" + state.clientFee }} |
|
|
|
{{ "¥" + state.detailsObj.product.oncePrice * 0.01 }} |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
<view class="flex"> |
|
|
@@ -72,13 +71,13 @@ |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
<view class="action"> |
|
|
|
<button type="default" class="button" @click="savaHandle()"> |
|
|
|
{{ "确认办理:¥" + state.allMoney }} |
|
|
|
</button> |
|
|
|
</view> |
|
|
|
|
|
|
|
|
|
|
|
</view> |
|
|
|
</template> |
|
|
|
|
|
|
@@ -88,10 +87,12 @@ |
|
|
|
onShow |
|
|
|
} from "@dcloudio/uni-app"; |
|
|
|
import { |
|
|
|
reactive,ref |
|
|
|
reactive, |
|
|
|
ref |
|
|
|
} from "vue"; |
|
|
|
import { |
|
|
|
etcQueryProduct,addProduct |
|
|
|
etcQueryProduct, |
|
|
|
addProduct |
|
|
|
} from "@/utils/network/api.js"; |
|
|
|
import { |
|
|
|
request |
|
|
@@ -123,26 +124,25 @@ |
|
|
|
msg |
|
|
|
} from "@/utils/utils"; |
|
|
|
const imgURL = `${fileURL}image/`; |
|
|
|
|
|
|
|
|
|
|
|
const savaHandle = () => { |
|
|
|
console.log("state.productId.length",state.productId.length) |
|
|
|
if(state.productId.length>0){ |
|
|
|
console.log("state.productId.length", state.productId.length) |
|
|
|
//判断是否有加购权益 |
|
|
|
if (state.productId.length > 0) { |
|
|
|
queryAddProduct(); |
|
|
|
uni.showModal({ |
|
|
|
// title: '提示', |
|
|
|
content: '确定支付', |
|
|
|
success: function (res) { |
|
|
|
if (res.confirm) { |
|
|
|
console.log('用户点击确定'); |
|
|
|
wxPayment(); |
|
|
|
} else if (res.cancel) { |
|
|
|
console.log('用户点击取消'); |
|
|
|
} |
|
|
|
} |
|
|
|
uni.showModal({ |
|
|
|
// title: '提示', |
|
|
|
content: '确定支付', |
|
|
|
success: function(res) { |
|
|
|
if (res.confirm) { |
|
|
|
console.log('用户点击确定'); |
|
|
|
wxPayment(); |
|
|
|
} else if (res.cancel) { |
|
|
|
console.log('用户点击取消'); |
|
|
|
} |
|
|
|
}); |
|
|
|
}else{ |
|
|
|
wxPayment(); |
|
|
|
} |
|
|
|
} |
|
|
|
}); |
|
|
|
// msg("确定绑定权益产品"); |
|
|
|
// wxPayment(); |
|
|
|
}; |
|
|
@@ -156,7 +156,7 @@ |
|
|
|
url: `https://api.weixin.qq.com/sns/jscode2session?appid=${wechatAppID}&secret=${wechatSecret}&js_code=${e.code}&grant_type=authorization_code`, |
|
|
|
success: (res: any) => { |
|
|
|
state.openid = res.data.openid; |
|
|
|
console.log("state.openid",state.openid); |
|
|
|
console.log("state.openid", state.openid); |
|
|
|
}, |
|
|
|
}); |
|
|
|
}, |
|
|
@@ -192,7 +192,7 @@ |
|
|
|
checkOrder(); |
|
|
|
}, |
|
|
|
fail: function(err) { |
|
|
|
checkOrder(); |
|
|
|
// checkOrder(); |
|
|
|
confirm(err, () => {}, "支付失败", false); |
|
|
|
}, |
|
|
|
}); |
|
|
@@ -223,22 +223,20 @@ |
|
|
|
}; |
|
|
|
onLoad((option: any) => { |
|
|
|
state.orderId = option.orderId; |
|
|
|
state.clientFee = option.clientFee / 100; |
|
|
|
// state.clientFee = option.clientFee / 100; |
|
|
|
state.id = option.id; |
|
|
|
getOpenID(); |
|
|
|
const data=JSON.parse(decodeURIComponent(option.data)); |
|
|
|
for(var i=0;i<data.length;i++){ |
|
|
|
data['isOpened']='node'; |
|
|
|
state.productMoney+=data[i]['discountPrice'] / 100; |
|
|
|
const data = JSON.parse(decodeURIComponent(option.data)); |
|
|
|
for (var i = 0; i < data.length; i++) { |
|
|
|
data['isOpened'] = 'node'; |
|
|
|
state.productMoney += data[i]['discountPrice'] / 100; |
|
|
|
state.productId.push(data[i]['equityId']) |
|
|
|
} |
|
|
|
state.allMoney=(state.productMoney+state.clientFee).toFixed(2) |
|
|
|
state.list=data; |
|
|
|
|
|
|
|
console.log("data",option) |
|
|
|
console.log("数组",JSON.parse(decodeURIComponent(option.data))) |
|
|
|
queryDetailsData(); |
|
|
|
|
|
|
|
state.list = data; |
|
|
|
queryDetailsData(); |
|
|
|
|
|
|
|
}); |
|
|
|
|
|
|
|
const state = reactive({ |
|
|
@@ -247,96 +245,92 @@ |
|
|
|
clientFee: undefined, |
|
|
|
id: "", |
|
|
|
options2: [{ |
|
|
|
text: '删除', |
|
|
|
style: { |
|
|
|
backgroundColor: '#F56C6C' |
|
|
|
} |
|
|
|
text: '删除', |
|
|
|
style: { |
|
|
|
backgroundColor: '#F56C6C' |
|
|
|
} |
|
|
|
], |
|
|
|
}], |
|
|
|
isOpened: 'none', |
|
|
|
list:[], |
|
|
|
productMoney:0, |
|
|
|
allMoney:0, |
|
|
|
productId:[], |
|
|
|
list: [], |
|
|
|
productMoney: 0, |
|
|
|
allMoney: 0, |
|
|
|
productId: [], |
|
|
|
// 弹框 |
|
|
|
type: 'center', |
|
|
|
msgType: 'success', |
|
|
|
messageText: '这是一条成功提示', |
|
|
|
value: '', |
|
|
|
detailsObj:'', |
|
|
|
detailsObj: '', |
|
|
|
}); |
|
|
|
const bindClick=(i)=>{ |
|
|
|
const bindClick = (i) => { |
|
|
|
console.log(i); |
|
|
|
uni.showToast({ |
|
|
|
title: "删除成功", |
|
|
|
icon: 'none' |
|
|
|
}); |
|
|
|
state.list.splice(i,1); |
|
|
|
state.productMoney=0; |
|
|
|
state.productId=[]; |
|
|
|
for(var k=0;k<state.list.length;k++){ |
|
|
|
state.productMoney+=state.list[k]['discountPrice'] / 100 |
|
|
|
state.list.splice(i, 1); |
|
|
|
state.productMoney = 0; |
|
|
|
state.productId = []; |
|
|
|
for (var k = 0; k < state.list.length; k++) { |
|
|
|
state.productMoney += state.list[k]['discountPrice'] / 100 |
|
|
|
state.productId.push(state.list[k]['equityId']) |
|
|
|
} |
|
|
|
state.allMoney=(state.productMoney+state.clientFee).toFixed(2) |
|
|
|
console.log("state.productId",state.productId) |
|
|
|
state.allMoney = (state.productMoney + state.clientFee).toFixed(2) |
|
|
|
console.log("state.productId", state.productId) |
|
|
|
}; |
|
|
|
const setOpened=()=> { |
|
|
|
if (state.isOpened === 'none') { |
|
|
|
state.isOpened = 'right'; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (state.isOpened === 'left') { |
|
|
|
state.isOpened = 'right'; |
|
|
|
return; |
|
|
|
} |
|
|
|
if (state.isOpened === 'right') { |
|
|
|
state.isOpened = 'none'; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
const change=(e)=> { |
|
|
|
state.isOpened = e; |
|
|
|
console.log('返回:', e); |
|
|
|
} |
|
|
|
// 加购权益产品接口 |
|
|
|
const queryAddProduct=()=>{ |
|
|
|
console.log("state.openid",state.openid); |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, //订单编号 |
|
|
|
openId: state.openid, //操作人 id |
|
|
|
equityId: state.productId.toString() , //权益Id |
|
|
|
totalAmount: state.allMoney * 100, //总金额 |
|
|
|
isRepeatPurchase:0 |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
request(addProduct, options).then((res) => { |
|
|
|
// msg("加购权益成功。"); |
|
|
|
}); |
|
|
|
const setOpened = () => { |
|
|
|
if (state.isOpened === 'none') { |
|
|
|
state.isOpened = 'right'; |
|
|
|
return; |
|
|
|
} |
|
|
|
const changeIsShow = (index) =>{ |
|
|
|
console.log(index,state.list[index]['isShow'],!state.list[index]['isShow']) |
|
|
|
state.list[index]['isShow']=!state.list[index]['isShow'] |
|
|
|
console.log("state.list",state.list) |
|
|
|
if (state.isOpened === 'left') { |
|
|
|
state.isOpened = 'right'; |
|
|
|
return; |
|
|
|
} |
|
|
|
const queryDetailsData=()=>{ |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, //订单编号 |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
request(queryDetails, options).then((res) => { |
|
|
|
state.detailsObj=stringToJson(res.bizContent); |
|
|
|
console.log("sdd",stringToJson(res.bizContent)) |
|
|
|
}); |
|
|
|
if (state.isOpened === 'right') { |
|
|
|
state.isOpened = 'none'; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
const change = (e) => { |
|
|
|
state.isOpened = e; |
|
|
|
} |
|
|
|
// 加购权益产品接口 |
|
|
|
const queryAddProduct = () => { |
|
|
|
console.log("state.openid", state.openid); |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, //订单编号 |
|
|
|
openId: state.openid, //操作人 id |
|
|
|
equityId: state.productId.toString(), //权益Id |
|
|
|
totalAmount: state.allMoney * 100, //总金额 |
|
|
|
isRepeatPurchase: 0 |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
request(addProduct, options).then((res) => {}); |
|
|
|
} |
|
|
|
const changeIsShow = (index) => { |
|
|
|
console.log(index, state.list[index]['isShow'], !state.list[index]['isShow']) |
|
|
|
state.list[index]['isShow'] = !state.list[index]['isShow'] |
|
|
|
console.log("state.list", state.list) |
|
|
|
} |
|
|
|
const queryDetailsData = () => { |
|
|
|
const options = { |
|
|
|
type: 2, |
|
|
|
data: { |
|
|
|
orderId: state.orderId, //订单编号 |
|
|
|
}, |
|
|
|
method: "POST", |
|
|
|
showLoading: true, |
|
|
|
}; |
|
|
|
request(queryDetails, options).then((res) => { |
|
|
|
state.detailsObj = stringToJson(res.bizContent); |
|
|
|
state.allMoney = (parseFloat(state.detailsObj.product.oncePrice * 0.01) + parseFloat(state.productMoney)).toFixed(2) |
|
|
|
}); |
|
|
|
} |
|
|
|
</script> |
|
|
|
|
|
|
|
<style lang="scss" scoped> |
|
|
@@ -413,6 +407,7 @@ |
|
|
|
|
|
|
|
.content { |
|
|
|
width: 48%; |
|
|
|
|
|
|
|
.title { |
|
|
|
font-size: 32rpx; |
|
|
|
font-family: Microsoft YaHei; |
|
|
@@ -439,10 +434,12 @@ |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
.del_item{ |
|
|
|
|
|
|
|
.del_item { |
|
|
|
background-color: rgb(41, 199, 207) !important; |
|
|
|
} |
|
|
|
.content-box{ |
|
|
|
|
|
|
|
.content-box { |
|
|
|
background-color: rgb(41, 199, 207); |
|
|
|
line-height: 80rpx; |
|
|
|
color: white; |
|
|
@@ -451,37 +448,45 @@ |
|
|
|
padding: 20rpx; |
|
|
|
box-sizing: border-box; |
|
|
|
} |
|
|
|
::v-deep.uni-swipe_button-text{ |
|
|
|
|
|
|
|
::v-deep.uni-swipe_button-text { |
|
|
|
font-size: 30rpx !important; |
|
|
|
} |
|
|
|
|
|
|
|
::v-deep.uni-swipe_button-group { |
|
|
|
font-size: 28rpx !important; |
|
|
|
} |
|
|
|
.add_all{ |
|
|
|
|
|
|
|
.add_all { |
|
|
|
width: 95%; |
|
|
|
margin: 0 auto; |
|
|
|
} |
|
|
|
.uni-swipe_box{ |
|
|
|
|
|
|
|
.uni-swipe_box { |
|
|
|
margin-bottom: 16rpx !important; |
|
|
|
} |
|
|
|
|
|
|
|
::v-deep.uni-swipe { |
|
|
|
margin-bottom: 16rpx !important; |
|
|
|
} |
|
|
|
.imageDefault{ |
|
|
|
height: 40rpx; |
|
|
|
width: 40rpx; |
|
|
|
transform: rotate(270deg); |
|
|
|
margin-right: 12rpx; |
|
|
|
color: white; |
|
|
|
|
|
|
|
.imageDefault { |
|
|
|
height: 40rpx; |
|
|
|
width: 40rpx; |
|
|
|
transform: rotate(270deg); |
|
|
|
margin-right: 12rpx; |
|
|
|
color: white; |
|
|
|
} |
|
|
|
.imageChange{ |
|
|
|
height: 40rpx; |
|
|
|
width: 40rpx; |
|
|
|
transform: rotate(90deg); |
|
|
|
margin-right: 12rpx; |
|
|
|
color: white; |
|
|
|
|
|
|
|
.imageChange { |
|
|
|
height: 40rpx; |
|
|
|
width: 40rpx; |
|
|
|
transform: rotate(90deg); |
|
|
|
margin-right: 12rpx; |
|
|
|
color: white; |
|
|
|
} |
|
|
|
.price{ |
|
|
|
|
|
|
|
.price { |
|
|
|
color: white; |
|
|
|
} |
|
|
|
</style> |