|
@@ -284,8 +284,51 @@ Page({
|
|
|
|
|
|
getOrder() {
|
|
|
var nid = this.data.worke.id;
|
|
|
- app.api.useApi(app.globalData.baseAppUrl + "api/makeorder", {
|
|
|
+ if(this.data.carNum>0){
|
|
|
+
|
|
|
+ app.api.useApi(app.globalData.baseAppUrl + "api/makeorder", {
|
|
|
+ network_id: nid,
|
|
|
+ }, "post").then(function (res) {
|
|
|
+ console.log(res);
|
|
|
+ if (res.code != 200) {
|
|
|
+ wx.showLoading({
|
|
|
+ title: res.message.msg,
|
|
|
+ })
|
|
|
+ wx.setTimeout(() => {
|
|
|
+ wx.hideLoading();
|
|
|
+ }, 1000);
|
|
|
+ } else {
|
|
|
+ var order_no = res.message.data.order_no;
|
|
|
+ wx.navigateTo({
|
|
|
+ url: '/pages/order/confirmOreder/confirmOreder?order_no=' + order_no,
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ }).catch(function (err) {
|
|
|
+ console.log(222);
|
|
|
+ })
|
|
|
+ }else{
|
|
|
+ wx.showToast({
|
|
|
+ title: '购物车不能为空',
|
|
|
+ icon: 'none',
|
|
|
+ duration: 2000
|
|
|
+ })
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ },
|
|
|
+
|
|
|
+ getOrderone(e) {
|
|
|
+ var gid = e.currentTarget.dataset.gid;
|
|
|
+ var nid = this.data.worke.id;
|
|
|
+ app.api.useApi(app.globalData.baseAppUrl + "api/CreateOrder", {
|
|
|
network_id: nid,
|
|
|
+ good_id: gid,
|
|
|
+ num: 1
|
|
|
}, "post").then(function (res) {
|
|
|
console.log(res);
|
|
|
if (res.code != 200) {
|