diff --git a/app.json b/app.json
index fb2085c..7484fea 100644
--- a/app.json
+++ b/app.json
@@ -49,7 +49,8 @@
"pages/chooseArea/chooseArea",
"pages/login/register",
"pages/shop/shop",
- "pages/store/store"
+ "pages/store/store",
+ "pages/order/payment"
],
"window": {
"backgroundTextStyle": "light",
diff --git a/app.wxss b/app.wxss
index 5036f66..6b26058 100644
--- a/app.wxss
+++ b/app.wxss
@@ -4,14 +4,15 @@ page {
background: #fff;
height:100%;
width:100%;
- font-family: "Helvetica Neue",Arial,"PingFang SC","Microsoft YaHei",sans-serif;
+ font-family: 'Microsoft YaHei';
}
.container {
height: 100%;
display: flex;
flex-direction: column;
box-sizing: border-box;
- font-family: serif;
+ font-family: 'Microsoft YaHei';
+ /* font-family: serif; */
}
.df{
display: -webkit-box;
diff --git a/images/QR_code.png b/images/QR_code.png
new file mode 100644
index 0000000..7ed42cd
Binary files /dev/null and b/images/QR_code.png differ
diff --git a/images/order_success.png b/images/order_success.png
new file mode 100644
index 0000000..273530f
Binary files /dev/null and b/images/order_success.png differ
diff --git a/pages/address/address.js b/pages/address/address.js
index 5750bf7..a89e89f 100644
--- a/pages/address/address.js
+++ b/pages/address/address.js
@@ -3,201 +3,39 @@ var WXAPI = require('../../utils/server.js');
var t = 0;
var moveY = 200;
var index = [0, 0, 0];
-var sheng = [];//省
-var shi = [];//城市
-var xian = [];//区县
Page({
data: {
- sheng: sheng,
- shi: shi,
- xian: xian,
+ region: ['请选择','',''],
value: [0, 0, 0],
cartId: 0,
- arr: [],
- show: false
},
-
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: function (options) {
- wx.setNavigationBarColor({
- frontColor: app.d.frontColor,
- backgroundColor: app.d.bgcolor, //页面标题为路由参数
- animation: {
- duration: 400,
- timingFunc: 'easeIn'
- }
- })
+ bindRegionChange: function (e) {
this.setData({
- bgcolor: app.d.bgcolor,
- cartId: options.cartId
- });
- this.AddressManagement();
- },
- aotuAddress: function () {
- var that = this;
- console.log(that.data.arr)
- wx.chooseAddress({
- success: function (res) {
- var user_name = res.userName;
- var mobile = res.telNumber;
- var address = res.detailInfo;
- that.setData({
- sheng: res.provinceName,
- shi: res.cityName,
- xian: res.countyName,
- province: res.provinceName,
- city: res.cityName,
- county: res.countyName,
- user_name: user_name,
- mobile: mobile,
- address: address,
- });
- }
+ region: e.detail.value
})
},
/**
- * 添加地址
+ * 生命周期函数--监听页面加载
*/
- AddressManagement: function () {
- var that = this;
- WXAPI.addressManagement({
- openid: app.globalData.userInfo.openid,
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- var sheng = data.sheng;
- var shi = data.shi;
- var xian = data.xian;
- that.setData({
- sheng: sheng,
- shi: shi,
- xian: xian
- });
- }
- else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
- },
- // 点击选择城市
- translate: function (e) {
- moveY = 200;
- this.data.show = true;
- t = 0;
- var province = this.data.province ? this.data.province : this.data.sheng[0].G_CName,
- city = this.data.city ? this.data.city : this.data.shi[0].G_CName,
- county = this.data.county ? this.data.county : this.data.xian[0].G_CName;
- console.log(province, city, county);
- this.setData({
- province: province,
- city: city,
- county: county
- });
- animationEvents(this, moveY, this.data.show);
- },
- //隐藏弹窗浮层
- hiddenFloatView(e) {
- moveY = 200;
- this.setData({
- show: false
- });
- t = 1;
- },
- //滑动事件
- bindChange: function (e) {
- var val = e.detail.value
- //判断滑动的是第几个column
- //若省份column做了滑动则定位到地级市和区县第一位
- if (index[0] != val[0]) {
- val[1] = 0;
- val[2] = 0;
- index[1] = 0;
- index[2] = 0;
- this.getCityArr(val[0]);//获取地级市数据
- this.getCountyInfo(val[0], val[1]);//获取区县数据
- } else { //若省份column未做滑动,地级市做了滑动则定位区县第一位
- if (index[1] != val[1]) {
- val[2] = 0;
- index[2] = 0;
- this.getCountyInfo(val[0], val[1]);//获取区县数据
- }
- }
- index = val;
- this.Preservation(index);
- },
- // 根据省获取市
- getCityArr: function (count) {
- var that = this;
- WXAPI.getCityArr({
- count: count,
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- that.setData({
- shi: data.shi
- });
- } else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
- },
- // 根据省市获取县
- getCountyInfo: function (count, column) {
- var that = this;
- WXAPI.getCountyInfo({
- count: count,
- column: column,
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- that.setData({
- xian: data.xian
- });
- } else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
- },
- // 滑动事件结束
- Preservation: function (rew) {
- var that = this;
- WXAPI.preservation({
- sheng: rew[0],
- shi: rew[1],
- xuan: rew[2]
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- var province = data.province;
- var city = data.city;
- var county = data.county;
- that.setData({
- province: province,
- city: city,
- county: county,
- });
- } else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
+ onLoad: function (options) {
+ // wx.setNavigationBarColor({
+ // frontColor: app.d.frontColor,
+ // backgroundColor: app.d.bgcolor, //页面标题为路由参数
+ // animation: {
+ // duration: 400,
+ // timingFunc: 'easeIn'
+ // }
+ // })
+ // this.setData({
+ // bgcolor: app.d.bgcolor,
+ // cartId: options.cartId
+ // });
},
// 点击保存
SaveAddress: function (e) {
+ var region = this.data.region
+ console.log(e.detail.value)
if (e.detail.value.user_name.length == 0) {
wx.showToast({
title: '联系人不得为空!',
@@ -212,7 +50,7 @@ Page({
duration: 1500
})
wx.hideToast()
- } else if (e.detail.value.province.length == 0) {
+ } else if (region[0] == '请选择') {
wx.showToast({
title: '城市不得为空!',
icon: 'loading',
@@ -225,32 +63,28 @@ Page({
//预处理验证手机号码
if (mobile.match(/^\d{11}$/)) {
WXAPI.saveAddress({
- openid: app.globalData.userInfo.openid,
+ accessId: app.globalData.accessId,
+ storeId: 239,
+ storeType: 1,
user_name: e.detail.value.user_name,
mobile: e.detail.value.mobile,
- province: e.detail.value.province,
- city: e.detail.value.city,
- county: e.detail.value.county,
- address: e.detail.value.address
+ place: region[0]+'-'+region[1]+'-'+region[2],
+ is_default: 0,
+ address: e.detail.value.address,
}).then(res => {
if (res.code == 200) {
- var data = res;
- wx.showToast({
- title: data.info,
- icon: 'loading',
- duration: 1500
- })
- } else {
+ var data = res.data;
app.d.islogin = true;
- wx.showToast({
- title: data.info,
- icon: 'success',
- duration: 1000
- });
//成功后返回上一页面
wx.navigateBack({
delta: 1
});
+ } else {
+ wx.showToast({
+ title: res.message,
+ icon: 'loading',
+ duration: 1500
+ });
}
});
} else {
diff --git a/pages/address/address.wxml b/pages/address/address.wxml
index fd35847..07a70e3 100644
--- a/pages/address/address.wxml
+++ b/pages/address/address.wxml
@@ -10,49 +10,14 @@
-
所在地区:
-
-
-
-
-
-
+
+ {{region[0]}} {{region[1]}} {{region[2]}}
+
-
-
-
-
- 取消
- 确定
-
-
-
-
-
-
- {{sheng.G_CName}}
-
-
-
-
-
- {{item.G_CName}}
-
-
-
-
-
- {{item.G_CName}}
-
-
-
-
-
-
@@ -62,8 +27,8 @@
-
+
\ No newline at end of file
diff --git a/pages/address/index.js b/pages/address/index.js
index a4c410a..b894709 100644
--- a/pages/address/index.js
+++ b/pages/address/index.js
@@ -71,39 +71,42 @@ Page({
onLoad: function (options) {
- wx.setNavigationBarColor({
- frontColor: app.d.frontColor,
- backgroundColor: app.d.bgcolor, //页面标题为路由参数
- animation: {
- duration: 400,
- timingFunc: 'easeIn'
- }
- })
- this.setData({
- bgcolor: app.d.bgcolor
- });
+ // wx.setNavigationBarColor({
+ // frontColor: app.d.frontColor,
+ // backgroundColor: app.d.bgcolor, //页面标题为路由参数
+ // animation: {
+ // duration: 400,
+ // timingFunc: 'easeIn'
+ // }
+ // })
+ // this.setData({
+ // bgcolor: app.d.bgcolor
+ // });
var that = this;
// 页面初始化 options为页面跳转所带来的参数
- if (options.cartId) {
- var cartId = options.cartId;
- } else {
- var cartId = 0;
- }
- WXAPI.addressIndex({
- openid: app.globalData.userInfo.openid
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- var address = data.adds;
- if (address == '') {
- var address = []
- }
- that.setData({
- address: address,
- cartId: cartId,
- })
- }
- });
+ // if (options.cartId) {
+ // var cartId = options.cartId;
+ // } else {
+ // var cartId = 0;
+ // }
+ that.DataonLoad()
+ // WXAPI.addressIndex({
+ // accessId: app.globalData.accessId,
+ // storeId: 239,
+ // storeType: 1,
+ // }).then(res => {
+ // if (res.code == 200) {
+ // var data = res;
+ // var address = data.adds;
+ // if (address == '') {
+ // var address = []
+ // }
+ // that.setData({
+ // address: address,
+ // cartId: cartId,
+ // })
+ // }
+ // });
},
bindCheckbox: function (e) {
@@ -255,8 +258,10 @@ Page({
content: '你确认移除吗',
success: function (res) {
res.confirm && WXAPI.addressDelAdds({
- openid: app.globalData.userInfo.openid,
- id_arr: addrId
+ accessId: app.globalData.accessId,
+ storeId: 239,
+ storeType: 1,
+ addr_id: addrId
}).then(res => {
if (res.code == 200) {
that.DataonLoad();
@@ -276,10 +281,12 @@ Page({
var that = this;
// 页面初始化 options为页面跳转所带来的参数
WXAPI.addressIndex({
- openid: app.globalData.userInfo.openid,
+ accessId: app.globalData.accessId,
+ storeId: 239,
+ storeType: 1,
}).then(res => {
if (res.code == 200) {
- var data = res;
+ var data = res.data;
var address = data.adds;
that.numbers = data.adds;
if (address == '') {
diff --git a/pages/address/index.wxml b/pages/address/index.wxml
index db20464..d5a49b9 100644
--- a/pages/address/index.wxml
+++ b/pages/address/index.wxml
@@ -1,46 +1,46 @@
-
- 地址管理
- 完成
-
+
+ 地址管理
+ 完成
+
-
-
- {{item.name}}
- {{item.tel}}
+
+
+ {{item.name}}
+ {{item.tel}}
+
+ {{item.address_xq}}
+
+
+
- {{item.address_xq}}
-
-
-
+
-
+
-
+
-
+
设置默认地址
-
+
-
-
+
+
-
-
-
+
编辑
删除
@@ -49,21 +49,19 @@
-
+
新增地址
-
-
-
-
-
-
-
- 全选
-
+
+
+
+
+
+ 全选
- 删除
+
+ 删除
\ No newline at end of file
diff --git a/pages/address/upaddress.js b/pages/address/upaddress.js
index a486225..4b6dc49 100644
--- a/pages/address/upaddress.js
+++ b/pages/address/upaddress.js
@@ -4,10 +4,6 @@ var t = 0;
var show = false;
var moveY = 200;
var index = [0, 0, 0];
-var sheng = [];//省
-var shi = [];//城市
-var xian = [];//区县
-
Page({
@@ -15,10 +11,9 @@ Page({
* 页面的初始数据
*/
data: {
- sheng: sheng,
- shi: shi,
- xian: xian,
+ region: ['请选择','',''],
value: [0, 0, 0],
+ address: ''
},
// 下拉刷新
onPullDownRefresh: function () {
@@ -32,178 +27,30 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
- wx.setNavigationBarColor({
- frontColor: app.d.frontColor,
- backgroundColor: app.d.bgcolor, //页面标题为路由参数
- animation: {
- duration: 400,
- timingFunc: 'easeIn'
- }
- })
+ console.log(options)
+ // wx.setNavigationBarColor({
+ // frontColor: app.d.frontColor,
+ // backgroundColor: app.d.bgcolor, //页面标题为路由参数
+ // animation: {
+ // duration: 400,
+ // timingFunc: 'easeIn'
+ // }
+ // })
+ var region = []
+ region.push(options.sheng)
+ region.push(options.city)
+ region.push(options.quyu)
this.setData({
- bgcolor: app.d.bgcolor,
- id_arr: options.addr_id
+ address: options,
+ region: region
});
-
- this.AddressManagement();
},
/**
* 修改地址
*/
- AddressManagement: function () {
- var that = this;
- WXAPI.addressUpAddsIndex({
- openid: app.globalData.userInfo.openid,
- id_arr: that.data.id_arr,
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- var address = data.adds;
- var province = data.province;
- var city = data.city;
- var county = data.county;
- if (address == '') {
- var address = []
- }
- that.setData({
- address: address,
- province: province,
- city: city,
- county: county
- })
- }
- });
- },
- AddressManagement1: function () {
- var that = this;
- WXAPI.addressManagement({
- openid: app.globalData.userInfo.openid,
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- var sheng = data.sheng;
- var shi = data.shi;
- var xian = data.xian;
- that.setData({
- sheng: sheng,
- shi: shi,
- xian: xian
- });
- } else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
- },
-
- // 点击选择城市
- translate: function (e) {
- if (t == 0) {
- moveY = 0;
- show = false;
- t = 1;
- } else {
- moveY = 200;
- show = true;
- t = 0;
- }
-
- animationEvents(this, moveY, show);
- this.AddressManagement1();
- },
- //隐藏弹窗浮层
- hiddenFloatView(e) {
- moveY = 200;
- this.setData({
- show: false
- });
- t = 1;
- },
- //滑动事件
- bindChange: function (e) {
- var val = e.detail.value
- //判断滑动的是第几个column
- //若省份column做了滑动则定位到地级市和区县第一位
- if (index[0] != val[0]) {
- this.getCityArr(val[0]);//获取地级市数据
- this.getCountyInfo(val[0], val[1]);//获取区县数据
- } else { //若省份column未做滑动,地级市做了滑动则定位区县第一位
- if (index[1] != val[1]) {
- this.getCountyInfo(val[0], val[1]);//获取区县数据
- }
- }
- index = val;
- this.Preservation(index);
- },
- // 根据省获取市
- getCityArr: function (count) {
- var that = this;
- WXAPI.getCityArr({
- count: count,
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- that.setData({
- shi: data.shi
- });
- } else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
- },
- // 根据省市获取县
- getCountyInfo: function (count, column) {
- var that = this;
- WXAPI.getCountyInfo({
- count: count,
- column: column,
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- that.setData({
- xian: data.xian
- });
- } else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
- },
- // 滑动事件结束
- Preservation: function (rew) {
- var that = this;
- WXAPI.preservation({
- sheng: rew[0],
- shi: rew[1],
- xuan: rew[2]
- }).then(res => {
- if (res.code == 200) {
- var data = res;
- var province = data.province;
- var city = data.city;
- var county = data.county;
- that.setData({
- province: province,
- city: city,
- county: county,
- });
- } else {
- wx.showToast({
- title: '非法操作!',
- duration: 2000
- });
- }
- });
- },
// 点击保存
SaveAddress: function (e) {
+ var region = this.data.region
var that = this;
if (e.detail.value.user_name.length == 0) {
wx.showToast({
@@ -219,7 +66,7 @@ Page({
duration: 1500
})
wx.hideToast()
- } else if (e.detail.value.province.length == 0) {
+ } else if (region[0] == '请选择') {
wx.showToast({
title: '城市不得为空!',
icon: 'loading',
@@ -227,44 +74,28 @@ Page({
})
wx.hideToast()
} else {
- WXAPI.saveAddress({
- openid: app.globalData.userInfo.openid,
+ var that = this;
+ WXAPI.addressUpAdds({
+ accessId: app.globalData.accessId,
+ storeId: 239,
+ storeType: 1,
user_name: e.detail.value.user_name,
- id_arr: that.data.id_arr,
mobile: e.detail.value.mobile,
- province: e.detail.value.province,
- city: e.detail.value.city,
- county: e.detail.value.county,
- address: e.detail.value.address
+ place: region[0]+'-'+region[1]+'-'+region[2],
+ is_default: 0,
+ address: e.detail.value.address,
+ addr_id: that.data.address.addr_id,
}).then(res => {
if (res.code == 200) {
- var data = res;
- wx.showModal({
- title: '提示',
- content: data.info,
- success: function (res) {
- wx.navigateBack({
- delta: 1
- })
- }
- });
+ wx.navigateBack()
} else {
wx.showToast({
- title: res.err,
+ title: res.message,
icon: 'loading',
duration: 1500
})
}
});
- // WXAPI.addressUpAdds({
- // from_id: formId,
- // userid: app.globalData.userInfo.openid
- // }).then(res => {
- // if (res.code == 200) {
- // var data = res;
-
- // }
- // });
}
}
})
diff --git a/pages/address/upaddress.wxml b/pages/address/upaddress.wxml
index 6e1f23f..556f406 100644
--- a/pages/address/upaddress.wxml
+++ b/pages/address/upaddress.wxml
@@ -2,55 +2,26 @@
-
+
+ 全部订单
待付款
待发货
@@ -99,7 +100,7 @@
-
+
合计:
¥ {{item.z_price}}
¥ {{item.total}}
diff --git a/pages/order/pay.js b/pages/order/pay.js
index 9e2b4f8..8c47e4e 100644
--- a/pages/order/pay.js
+++ b/pages/order/pay.js
@@ -35,6 +35,7 @@ Page({
pay_xs: true,
pages_sx: true,
dz_stu: false,
+ productAry: '',
},
go: function (e) {
console.log(e);
@@ -96,8 +97,6 @@ Page({
wallet: wallet, // 钱包状态
});
this.Settlement(options);
-
-
},
//页面加载完成函数
onReady: function () {
@@ -185,7 +184,15 @@ Page({
if (that.data.d_yuan) {
data.coupon_money = Number(data.coupon_money) - Number(that.data.user_money);
}
+ var pays = []
+ if (data.payment.bank_pay == 1) {
+ pays.push({'name':'银行转账','icon':'/images/order_success.png'})
+ }
+ // if (data.payment.wallet_pay == 1) {
+ // pays.push({'name':'余额支付','icon':'/images/wx.png'})
+ // }
that.setData({
+ productAry: options.product,
addemt: data.addemt, // 是否有收货地址
address: data.address, // 收货地址
addrId: data.address.id ? data.address.id : '', // 收货地址id
@@ -199,7 +206,8 @@ Page({
scorebuy: data.grade_rate_amount, //积分消费规则
zhekou: data.preferential_amount ? data.preferential_amount : '', //会员折扣
freight: data.freight ? data.freight : 0, //运费
- remind: false
+ remind: false,
+ pays: pays,
});
} else {
that.setData({
@@ -421,92 +429,91 @@ Page({
// 提交订单支付
createProductOrderByWX: function (e) {
var that = this;
- if (this.data.ispayOrder) {
- return
- }
- this.setData({
- ispayOrder: true
- })
+ // if (that.data.ispayOrder) {
+ // return
+ // }
+ // that.setData({
+ // ispayOrder: true
+ // })
- var paytype = that.data.paytype;
- if (paytype) {
- that.setData({
- paytype: paytype,
- });
- } else {
- wx.showToast({
- title: '已为您选择默认支付方式',
- icon: 'none',
- duration: 2000,
- });
- //当都没有选中时 循环找到默认的支付方式 在设置支付方式数据
- var pays = that.data.pays,
- j = 0;
- for (j = 0; j < pays.length; j++) {
- if (pays[j].value == 'wxPay') {
- pays[j].checked = true;
- } else {
- pays[j].checked = false;
- }
- }
+ // var paytype = that.data.paytype;
+ // if (paytype) {
+ // that.setData({
+ // paytype: paytype,
+ // });
+ // } else {
+ // wx.showToast({
+ // title: '已为您选择默认支付方式',
+ // icon: 'none',
+ // duration: 2000,
+ // });
+ // //当都没有选中时 循环找到默认的支付方式 在设置支付方式数据
+ // var pays = that.data.pays,
+ // j = 0;
+ // for (j = 0; j < pays.length; j++) {
+ // if (pays[j].value == 'wxPay') {
+ // pays[j].checked = true;
+ // } else {
+ // pays[j].checked = false;
+ // }
+ // }
- that.setData({
- pays: pays,
- paytype: 'wxPay',
- });
+ // that.setData({
+ // pays: pays,
+ // paytype: 'wxPay',
+ // });
- paytype = 'wxPay';
- return;
- }
- that.setData({
- form_id: e.detail.formId,
- });
- var address = e.detail.value.address;
+ // paytype = 'wxPay';
+ // return;
+ // }
+ // that.setData({
+ // form_id: e.detail.formId,
+ // });
+ var address = that.data.address;
if (address) {
- // 收货地址存在
- if (paytype == 'wallet_Pay') {
- if (that.data.pay_xs) {
- wx.showModal({
- title: '余额支付',
- content: '是否使用余额支付?',
- success: function (res) {
- if (res.confirm) {
- //组合支付 替换数据
- that.createProductOrder();
- console.log('用户点击确定');
- } else if (res.cancel) {
- that.setData({
- ispayOrder: false
- })
- wx.hideLoading()
- console.log('用户点击取消')
- }
- }
- })
- } else {
- wx.showModal({
- title: '订单提交',
- content: '是否使用消费金支付?',
- success: function (res) {
- if (res.confirm) {
- //组合支付 替换数据
- that.createProductOrder();
- console.log('用户点击确定');
- } else if (res.cancel) {
- this.setData({
- ispayOrder: false
- })
- wx.hideLoading()
- console.log('用户点击取消')
- }
- }
- })
- }
-
- } else {
- that.createProductOrder();
- }
-
+ // // 收货地址存在
+ // if (paytype == 'wallet_Pay') {
+ // if (that.data.pay_xs) {
+ // wx.showModal({
+ // title: '余额支付',
+ // content: '是否使用余额支付?',
+ // success: function (res) {
+ // if (res.confirm) {
+ // //组合支付 替换数据
+ // that.createProductOrder();
+ // console.log('用户点击确定');
+ // } else if (res.cancel) {
+ // that.setData({
+ // ispayOrder: false
+ // })
+ // wx.hideLoading()
+ // console.log('用户点击取消')
+ // }
+ // }
+ // })
+ // } else {
+ // wx.showModal({
+ // title: '订单提交',
+ // content: '是否使用消费金支付?',
+ // success: function (res) {
+ // if (res.confirm) {
+ // //组合支付 替换数据
+ // that.createProductOrder();
+ // console.log('用户点击确定');
+ // } else if (res.cancel) {
+ // this.setData({
+ // ispayOrder: false
+ // })
+ // wx.hideLoading()
+ // console.log('用户点击取消')
+ // }
+ // }
+ // })
+ // }
+ // } else {
+ // that.createProductOrder();
+ // }
+ that.createProductOrder();
} else {
// 没有收货地址
wx.showToast({
@@ -519,67 +526,119 @@ Page({
// 确认订单
createProductOrder: function () {
var that = this;
- this.setData({
- btnDisabledbtnDisabled: false,
- pages_sx: false
- })
- var paytype = that.data.paytype;
- var type1 = that.data.type1;
- app.d.purchase = 1; //设置购物车刷新
- wx.request({
- url: app.d.ceshiUrl + '&action=product&m=payment',
- method: 'post',
- data: {
- uid: that.data.userId, // 微信id
- cart_id: that.data.cartId, // 购物车id
- type: paytype, // 支付方式
- total: that.data.coupon_money, // 付款金额
- coupon_id: that.data.coupon_id, // 优惠券ID
- allow: that.data.allow, // 用户使用消费金
- name: that.data.name, // 满减金额名称
- reduce_money: that.data.reduce_money, // 满减金额
- dkyuan: that.data.d_yuan,
- freight: that.data.freight,
- num: that.data.num1 ? that.data.num1 : 0, //直接购买数量
- typee: that.data.type ? that.data.type : 0, //购买类型1直接购买,0从购物车买
- },
- header: {
- 'Content-Type': 'application/x-www-form-urlencoded'
- },
- success: function (res) {
- var data = res.data;
- console.log(res)
- if (data.status == 1) {
- // 余额支付
- if (data.arr.pay_type == 'wallet_Pay') {
- that.wallet_pay(data.arr);
- }
- if (data.arr.pay_type == 'wxPay') {
- // 微信支付
- wx.showLoading({
- title: '加载中',
- })
- that.wxpay(data.arr);
- }
- } else {
- wx.showToast({
- title: res.data.err,
- icon: 'none',
- duration: 2500
- });
-
+ WXAPI.orderPayment({
+ accessId: app.globalData.accessId,
+ storeId: 239,
+ storeType: 1,
+ cart_id: '',
+ address_id: that.data.addrId,
+ coupon_id: 0,
+ remarks: '',
+ vipSource: 0,
+ product: that.data.productAry,
+ pay_type: '',
+ }).then(res => {
+ if (res.code == 200) {
+ var data = res.data
+ var jsonstr = JSON.stringify(data)
+ var result = {
+ orderStr: jsonstr,
+ price: data.total
}
- },
- fail: function (e) {
+ wx.navigateTo({
+ url: "/pages/order/payment?orderId="+data.sNo+"&price="+data.total,
+ })
+ // that.leaveSettlement(result)
+ } else {
wx.showToast({
- title: '网络异常!err:createProductOrder',
+ title: res.message,
+ icon: 'none',
duration: 2000
});
- }
+ }
});
+ // this.setData({
+ // btnDisabledbtnDisabled: false,
+ // pages_sx: false
+ // })
+ // var paytype = that.data.paytype;
+ // var type1 = that.data.type1;
+ // app.d.purchase = 1; //设置购物车刷新
+ // wx.request({
+ // url: app.d.ceshiUrl + '&action=product&m=payment',
+ // method: 'post',
+ // data: {
+ // uid: that.data.userId, // 微信id
+ // cart_id: that.data.cartId, // 购物车id
+ // type: paytype, // 支付方式
+ // total: that.data.coupon_money, // 付款金额
+ // coupon_id: that.data.coupon_id, // 优惠券ID
+ // allow: that.data.allow, // 用户使用消费金
+ // name: that.data.name, // 满减金额名称
+ // reduce_money: that.data.reduce_money, // 满减金额
+ // dkyuan: that.data.d_yuan,
+ // freight: that.data.freight,
+ // num: that.data.num1 ? that.data.num1 : 0, //直接购买数量
+ // typee: that.data.type ? that.data.type : 0, //购买类型1直接购买,0从购物车买
+ // },
+ // header: {
+ // 'Content-Type': 'application/x-www-form-urlencoded'
+ // },
+ // success: function (res) {
+ // var data = res.data;
+ // console.log(res)
+ // if (data.status == 1) {
+ // // 余额支付
+ // if (data.arr.pay_type == 'wallet_Pay') {
+ // that.wallet_pay(data.arr);
+ // }
+ // if (data.arr.pay_type == 'wxPay') {
+ // // 微信支付
+ // wx.showLoading({
+ // title: '加载中',
+ // })
+ // that.wxpay(data.arr);
+ // }
+ // } else {
+ // wx.showToast({
+ // title: res.data.err,
+ // icon: 'none',
+ // duration: 2500
+ // });
+
+ // }
+ // },
+ // fail: function (e) {
+ // wx.showToast({
+ // title: '网络异常!err:createProductOrder',
+ // duration: 2000
+ // });
+ // }
+ // });
// }
},
-
+ //结算支付
+ leaveSettlement(result) {
+ var that = this;
+ WXAPI.leaveSettlement({
+ accessId: app.globalData.accessId,
+ storeId: 239,
+ storeType: 1,
+ order_list: result.orderStr,
+ price: result.price
+ }).then(res => {
+ if (res.code == 200) {
+ var data = res.data
+ console.log(data)
+ } else {
+ wx.showToast({
+ title: res.message,
+ icon: 'none',
+ duration: 2000
+ });
+ }
+ });
+ },
// 发起钱包支付
wallet_pay: function (order) {
wx.hideLoading()
diff --git a/pages/order/pay.json b/pages/order/pay.json
index 3057aed..205320e 100644
--- a/pages/order/pay.json
+++ b/pages/order/pay.json
@@ -1,3 +1,4 @@
{
- "navigationBarTitleText": "订单确认"
+ "usingComponents": {},
+ "navigationBarTitleText": "订单确认"
}
\ No newline at end of file
diff --git a/pages/order/pay.wxml b/pages/order/pay.wxml
index 64e74c0..7314f25 100644
--- a/pages/order/pay.wxml
+++ b/pages/order/pay.wxml
@@ -46,6 +46,7 @@
添加收货地址
+
@@ -53,6 +54,7 @@
{{item.shop_name}}
+
@@ -73,7 +75,6 @@
-
@@ -106,10 +107,10 @@
diff --git a/pages/order/pay.wxss b/pages/order/pay.wxss
index 3d7d4e8..602a086 100644
--- a/pages/order/pay.wxss
+++ b/pages/order/pay.wxss
@@ -130,7 +130,7 @@ width: 100%;
flex-direction: row;
justify-content: space-between;
align-items: center;
- margin-top: 5px;
+ /* margin-top: 5px; */
font-size: 16px;
width: 100%;
}
@@ -168,15 +168,15 @@ display:block;
}
li{
- font-size: 14px; line-height: 34px;color: #575757;height: 34px;display: block;padding-left: 10px;
- margin:10px;
-border:2px solid #ff4081;
-border-radius:20rpx;
-text-align:center;
+ font-size: 14px; line-height: 34px;color: #575757;height: 34px;display: block;padding-left: 10px;
+ margin:10px;
+ border:2px solid #ff4081;
+ border-radius:20rpx;
+ text-align:center;
}
.show {
- display: block;
+ display: block;
}
.hidden {
display: none;
@@ -600,13 +600,22 @@ color:#fff;
.radio-group {
-display:block;
-width:100%;
+ display:block;
+ width:100%;
+}
+.payment{
+ width:100%;
+ padding:15rpx 5rpx;
+ display: flex;
+ align-items: center;
+}
+.payment image{
+ width: 42rpx;
+ height: 42rpx;
+}
+.payment text{
+ margin-left: 15rpx;
}
-
-
-
-
/*优惠券 */
.orderDetails {
@@ -736,7 +745,7 @@ left:-13px;
}
.shop-view {
display:flex;
- height: 60rpx;
+ height: 85rpx;
align-items: center;
}
.shop-view image {
diff --git a/pages/order/payment.js b/pages/order/payment.js
new file mode 100644
index 0000000..0c8f804
--- /dev/null
+++ b/pages/order/payment.js
@@ -0,0 +1,100 @@
+// pages/order/payment.js
+Page({
+
+ /**
+ * 页面的初始数据
+ */
+ data: {
+ orderId: '',
+ price: '',
+ company: '常州互利智能科技有限公司',
+ account: '123 4567 1234 456 1234',
+ bank: '中国银行',
+ },
+ copyAct() {
+ var that = this
+ wx.setClipboardData({
+ data: that.data.orderId,
+ success: function (res) {
+ wx.showToast({
+ title: '复制成功',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+ copyAccount() {
+ var that = this
+ var content = '收款方 '+that.data.company+'\n'+'收款账号 '+that.data.account+'\n'+'开户银行'+that.data.bank
+ wx.setClipboardData({
+ data: content,
+ success: function (res) {
+ wx.showToast({
+ title: '复制成功',
+ icon: 'none',
+ duration: 2000
+ })
+ }
+ })
+ },
+ /**
+ * 生命周期函数--监听页面加载
+ */
+ onLoad(options) {
+ var that = this
+ that.setData({
+ orderId: options.orderId,
+ price: options.price,
+ })
+ },
+
+ /**
+ * 生命周期函数--监听页面初次渲染完成
+ */
+ onReady() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面显示
+ */
+ onShow() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面隐藏
+ */
+ onHide() {
+
+ },
+
+ /**
+ * 生命周期函数--监听页面卸载
+ */
+ onUnload() {
+
+ },
+
+ /**
+ * 页面相关事件处理函数--监听用户下拉动作
+ */
+ onPullDownRefresh() {
+
+ },
+
+ /**
+ * 页面上拉触底事件的处理函数
+ */
+ onReachBottom() {
+
+ },
+
+ /**
+ * 用户点击右上角分享
+ */
+ onShareAppMessage() {
+
+ }
+})
\ No newline at end of file
diff --git a/pages/order/payment.json b/pages/order/payment.json
new file mode 100644
index 0000000..19fa411
--- /dev/null
+++ b/pages/order/payment.json
@@ -0,0 +1,4 @@
+{
+ "usingComponents": {},
+ "navigationBarTitleText": "订单支付"
+}
\ No newline at end of file
diff --git a/pages/order/payment.wxml b/pages/order/payment.wxml
new file mode 100644
index 0000000..861794d
--- /dev/null
+++ b/pages/order/payment.wxml
@@ -0,0 +1,39 @@
+
+
+
+ 订单编号:
+ {{orderId}}
+ | 复制
+
+
+
+
+ 支付金额
+ ¥{{price}}
+
+
+
+
+ 收款方
+ {{company}}
+
+
+ 收款账号
+ {{account}}
+
+
+ 开户银行
+ {{bank}}
+
+
+
+
+ 如有其他问题,请联系客服
+
+
+
+
diff --git a/pages/order/payment.wxss b/pages/order/payment.wxss
new file mode 100644
index 0000000..b591221
--- /dev/null
+++ b/pages/order/payment.wxss
@@ -0,0 +1,109 @@
+/* pages/order/payment.wxss */
+page {
+ height: 100%;
+ background-color: #F6F6FB;
+}
+.codeView{
+ padding-top: 25rpx;
+ display: flex;
+ height: 60rpx;
+ background-color: white;
+}
+.codeView .order{
+ font-size: 28rpx;
+ color: #333333;
+}
+.copyBtn{
+ margin-left: 16rpx;
+ width: 80rpx;
+ height: 60rpx;
+ font-size: 28rpx;
+ color: #D4282D;
+}
+.header {
+ display: flex;
+ height: 150rpx;
+ background-color: white;
+}
+.header image{
+ margin-top: 10rpx;
+ margin-left: 35rpx;
+ width: 48rpx;
+ height: 48rpx;
+}
+.header text{
+ margin-top: 10rpx;
+ margin-left: 10rpx;
+ height: 48rpx;
+ font-weight: bold;
+ line-height: 48rpx;
+ font-size: 32rpx;
+ color: #333333;
+}
+.info{
+ margin-top: 35rpx;
+ /* margin-bottom: 10rpx; */
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
+.info text{
+ font-size: 28rpx;
+ color: #333333;
+ height: 50rpx;
+ line-height: 50rpx;
+}
+.info .price{
+ font-weight: bold;
+ font-size: 64rpx;
+ color: #D4282D;
+}
+.accountCopy{
+ position: absolute;
+ right: 32rpx;
+ font-size: 24rpx;
+ color: #D4282D;
+ padding: 0rpx 10rpx;
+ height: 50rpx;
+ line-height: 50rpx;
+ border-radius: 8rpx;
+ border: 1rpx solid #D4282D;
+}
+.account{
+ margin-top: 30rpx;
+ margin-left: 32rpx;
+ margin-right: 32rpx;
+ background-color: white;
+}
+.titleView{
+ height: 90rpx;
+ line-height: 90rpx;
+ border-bottom: solid 1px #F6F6F6;
+}
+.name{
+ margin-left: 24rpx;
+ font-size: 28rpx;
+ color: #999999;
+}
+.detail{
+ margin-left: 100rpx;
+ font-size: 28rpx;
+ color: #333333;
+}
+.qrcode{
+ margin-top: 35rpx;
+ display: flex;
+ flex-direction: column;
+ align-items: center;
+ justify-content: center;
+}
+.qrcode text{
+ font-size: 32rpx;
+ color: #333333;
+}
+.qrcode image{
+ margin-top: 30rpx;
+ width: 320rpx;
+ height: 320rpx;
+}
\ No newline at end of file
diff --git a/pages/user/user.wxml b/pages/user/user.wxml
index 037e186..cc29612 100644
--- a/pages/user/user.wxml
+++ b/pages/user/user.wxml
@@ -132,7 +132,7 @@
-
+
{{item.text}}
@@ -140,7 +140,7 @@
-
+
diff --git a/project.private.config.json b/project.private.config.json
index 1b6bfdf..5c62339 100644
--- a/project.private.config.json
+++ b/project.private.config.json
@@ -5,5 +5,5 @@
"compileHotReLoad": true,
"urlCheck": false
},
- "libVersion": "2.20.2"
+ "libVersion": "2.25.3"
}
\ No newline at end of file
diff --git a/utils/server.js b/utils/server.js
index eb94a99..b189bbc 100644
--- a/utils/server.js
+++ b/utils/server.js
@@ -102,8 +102,33 @@ module.exports = {
productAddCart: (data) => { //加入购物车
return requestServer('&action=product&app=add_cart', 'post', data)
},
-
-
+ //确认订单 payment
+ orderPayment: (data) => {
+ return requestServer('&action=order&app=payment', 'post', data)
+ },
+ leaveSettlement: (data) => {
+ return requestServer('&action=order&app=leave_Settlement', 'post', data)
+ },
+ addressIndex: (data) => { //地址管理列表
+ return requestServer('&action=address&app=index', 'post', data)
+ },
+ saveAddress: (data) => { //添加地址
+ return requestServer('&action=address&app=SaveAddress', 'post', data)
+ },
+ addressDelAdds: (data) => { //删除地址
+ return requestServer('&action=address&app=del_adds', 'post', data)
+ },
+ addressUpAdds: (data) => { //修改地址
+ return requestServer('&action=address&app=up_adds', 'post', data)
+ },
+ getLocation: (data) => { //获取地址信息
+ return requestServer('&action=index&app=get_location', 'post', data)
+ },
+ //确认订单 payment
+ orderList: (data) => {
+ return requestServer('&action=order&app=index', 'post', data)
+ },
+ /* -------------------- */
productSaveFormid: (data) => {
return requestServer('&action=product&m=save_formid', 'post', data)
},
@@ -133,41 +158,23 @@ module.exports = {
return requestServer('&action=product&m=delcart', 'post', data)
},
addressManagement: (data) => { //添加地址
- return requestServer('&action=user&m=AddressManagement', 'post', data)
- },
- getCityArr: (data) => { //根据省获取市
- return requestServer('&action=user&m=getCityArr', 'post', data)
- },
- getCountyInfo: (data) => { //根据省市获取县
- return requestServer('&action=user&m=getCountyInfo', 'post', data)
- },
- getLocation: (data) => { //获取地址信息
- return requestServer('&action=index&app=get_location', 'post', data)
+ return requestServer('&action=user&app=AddressManagement', 'post', data)
},
preservation: (data) => {
return requestServer('&action=user&m=Preservation', 'post', data)
},
- saveAddress: (data) => {
- return requestServer('&action=user&m=SaveAddress', 'post', data)
- },
addressDelselect: (data) => {
return requestServer('&action=address&m=del_select', 'post', data)
},
- addressIndex: (data) => {
- return requestServer('&action=address&m=index', 'post', data)
- },
+
addressSetDefault: (data) => { //设置默认地址
return requestServer('&action=address&m=set_default', 'post', data)
},
- addressDelAdds: (data) => { //删除地址
- return requestServer('&action=address&m=del_adds', 'post', data)
- },
+
addressUpAddsIndex: (data) => { //修改地址
return requestServer('&action=address&m=up_addsindex', 'post', data)
},
- addressUpAdds: (data) => { //修改地址
- return requestServer('&action=address&m=up_adds', 'post', data)
- },
+
envelopeIndex: (data) => { //
return requestServer('&action=envelope&m=index', 'post', data)
},