|
@@ -6,13 +6,14 @@ var app = getApp();
|
|
|
|
|
|
Page({
|
|
|
data: {
|
|
|
+ addressShow: false,
|
|
|
addressList:[],
|
|
|
address:{
|
|
|
detail:'',
|
|
|
name:'',
|
|
|
tel:''
|
|
|
},
|
|
|
- shopAddress:'',//门店地址
|
|
|
+ // shopAddress:'',//门店地址
|
|
|
buyNumber:'',
|
|
|
memberDiscount: '',
|
|
|
isMember: false,
|
|
@@ -105,7 +106,8 @@ Page({
|
|
|
petinfo: null, //宠物保险内容
|
|
|
shareId: 0,
|
|
|
userInfo: {},
|
|
|
- remarkDisable: false,
|
|
|
+ remarkDisable: false,
|
|
|
+ code:'',
|
|
|
},
|
|
|
//获取checkou信息
|
|
|
getCheckoutInfo: function () {
|
|
@@ -130,7 +132,7 @@ Page({
|
|
|
// isMember: res.data.isMember,
|
|
|
// memberDiscount: res.data.memberDiscount,
|
|
|
checkedGoodsList: res.data.skus,
|
|
|
- shopAddress:res.data.address,
|
|
|
+ // shopAddress:res.data.address,
|
|
|
buyNumber:res.data.buyNumber,
|
|
|
actualPrice: res.data.price,
|
|
|
addressId:res.data.addressId
|
|
@@ -434,8 +436,14 @@ Page({
|
|
|
}
|
|
|
|
|
|
},
|
|
|
-
|
|
|
- orderPay() {
|
|
|
+ async getWxCode(){
|
|
|
+ let res=await user.login();
|
|
|
+ console.log(res);
|
|
|
+ this.setData({
|
|
|
+ code:res.code
|
|
|
+ });
|
|
|
+ },
|
|
|
+ async orderPay() {
|
|
|
if(this.data.addressId==null||this.data.addressId==''){
|
|
|
if(this.data.address.detail==''){
|
|
|
util.showErrorToast('请输入收货地址');
|
|
@@ -463,7 +471,8 @@ Page({
|
|
|
receiverPhone:this.data.address.tel
|
|
|
|
|
|
};
|
|
|
-
|
|
|
+await this.getWxCode();
|
|
|
+
|
|
|
util.request(mall.OrderSubmit, orderInfo, 'POST').then(res => {
|
|
|
if (res.errno === 0) {
|
|
|
console.log(res);
|
|
@@ -471,9 +480,11 @@ Page({
|
|
|
const orderId = res.data;
|
|
|
this.setData({
|
|
|
orderId: orderId
|
|
|
- });
|
|
|
+ });
|
|
|
+
|
|
|
util.request(mall.OrderPrepay, {
|
|
|
- orderId: orderId
|
|
|
+ orderId: orderId,
|
|
|
+ code:this.data.code
|
|
|
}, 'POST').then(res => {
|
|
|
if (res.errno === 0) {
|
|
|
const payParam = res.data;
|
|
@@ -1142,9 +1153,12 @@ Page({
|
|
|
payFailShow: false
|
|
|
});
|
|
|
},
|
|
|
- rePay() {
|
|
|
+ async rePay() {
|
|
|
+ await this.getWxCode();
|
|
|
+
|
|
|
util.request(mall.OrderPrepay, {
|
|
|
- orderId: this.data.orderId
|
|
|
+ orderId: this.data.orderId,
|
|
|
+ code:this.data.code
|
|
|
}, 'POST').then(res => {
|
|
|
if (res.errno === 0) {
|
|
|
const payParam = res.data;
|
|
@@ -1198,7 +1212,7 @@ getAddressList() {
|
|
|
util.request(mall.AddressList).then((res) => {
|
|
|
if (res.errno === 0) {
|
|
|
this.setData({
|
|
|
- addressList: res.data.list
|
|
|
+ addressList: res.data
|
|
|
});
|
|
|
let current = this.data.addressList.filter((item) => {
|
|
|
return item.id == this.data.addressId;
|
|
@@ -1216,7 +1230,43 @@ addressSelect() {
|
|
|
addressShow: true
|
|
|
});
|
|
|
},
|
|
|
-
|
|
|
+addressConfirm(e) {
|
|
|
+ let address = e.currentTarget.dataset.address;
|
|
|
+ this.setData({
|
|
|
+ checkedAddress: address,
|
|
|
+ addressShow: false
|
|
|
+ });
|
|
|
+},
|
|
|
+onAddressClose() {
|
|
|
+ this.setData({
|
|
|
+ addressShow: false
|
|
|
+ })
|
|
|
+},
|
|
|
+goAddAddress(){
|
|
|
+ this.setData({
|
|
|
+ addressId:0,
|
|
|
+ addressShow: false
|
|
|
+ })
|
|
|
+},
|
|
|
+bindinputAddress(event) {
|
|
|
+let detail = event.detail.value.replace(/[,,]/g, '');
|
|
|
+ this.setData({
|
|
|
+ 'address.detail': detail
|
|
|
+ });
|
|
|
+
|
|
|
+},
|
|
|
+bindinputMobile(event) {
|
|
|
+ let tel = event.detail.value;
|
|
|
+ this.setData({
|
|
|
+ 'address.tel': tel
|
|
|
+ });
|
|
|
+},
|
|
|
+bindinputName(event) {
|
|
|
+ let name = event.detail.value;
|
|
|
+ this.setData({
|
|
|
+ 'address.name': name
|
|
|
+ });
|
|
|
+},
|
|
|
|
|
|
|
|
|
|