请问大家如何调用这个数据

XGVIP 2020-05-03 03:38:59
Settlement: function () {
var that = this;
console.log(that)
console.log('99999')
wx.request({
url: app.d.ceshiUrl + '&action=product&m=Settlement',
method: 'post',
data: {
cart_id: that.data.cartId, // 购物车id
uid: that.data.userId, // 微信id
num1: that.data.num1, //数量
type: that.data.type, //(1.直接结算 0购物车结算)
},
header: {
'Content-Type': 'application/x-www-form-urlencoded'
},
success: function (res) {
var status = res.data.status;
if (status == 1) {
if (that.data.allow) {
res.data.arr.coupon_money = Number(res.data.arr.coupon_money) - Number(that.data.allow);
}
if (that.data.d_yuan) {
res.data.arr.coupon_money = Number(res.data.arr.coupon_money) - Number(that.data.user_money);
}
console.log(res.data.arr);
console.log('res.data.arr');
that.setData({
addemt: res.data.arr.addemt, // 是否有收货地址
address: res.data.arr.adds, // 收货地址
addrId: res.data.arr.adds.id ? res.data.arr.adds.id : '', // 收货地址id
productData: res.data.arr.pro, // 商品信息
total: res.data.arr.price, // 总价
money: res.data.arr.money, // 优惠券金额
coupon_money: Number(parseFloat(res.data.arr.coupon_money).toFixed(3).slice(0, -1)), // 优惠后金额
user_money: res.data.arr.user_money, // 用户余额
coupon_id: res.data.arr.coupon_id, // 优惠券id
discount: res.data.arr.discount, //控制优惠方式
scorebuy: res.data.arr.scorebuy, //积分消费规则
zhekou: res.data.arr.zhekou ? res.data.arr.zhekou : '', //会员折扣
freight: res.data.arr.yunfei ? res.data.arr.yunfei : 0, //运费
});

setTimeout(function () {
that.setData({
remind: false
});
}, 1000);
} else {
that.setData({
remind: true
});
wx.showToast({
title: res.data.err,
icon: 'none',
duration: 2000,
});
if (status == 0) {
setTimeout(function () {
util.getUesrBgplus(that, app, false)
wx.navigateBack({
delta: 1
})
}, 2000);

} else {
setTimeout(function () {
util.getUesrBgplus(that, app, false)
wx.navigateBack({
delta: 1
})
}, 2000);
}
}
},
error: function (e) {
wx.showToast({
title: '网络异常!',
duration: 2000
});
}
});

},


请问大家如何调用这个数据:
如我需要调用这个数据 total: res.data.arr.price, // 总价
注:我是需要在同这个JS页面中调用
...全文
365 1 打赏 收藏 转发到动态 举报
写回复
用AI写文章
1 条回复
切换为时间正序
请发表友善的回复…
发表回复
葉幺 2020-05-06
  • 打赏
  • 举报
回复
js中调用 写成this.total 页面中调用total

3,143

社区成员

发帖
与我相关
我的任务
社区描述
微信开发即微信公众平台开发,将企业信息、服务、活动等内容通过微信网页的方式进行表现,通过二次开发可以将公众账号由一个媒体型营销工具转化成提供服务的产品。
社区管理员
  • 微信开发
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧