Просмотр исходного кода

新增拼团详情页

tags/富茂链客4.1.0
刘晖 6 лет назад
Родитель
Сommit
e48ab17f60
8 измененных файлов: 255 добавлений и 106 удалений
  1. +2
    -1
      app.json
  2. +9
    -1
      config/config.js
  3. +66
    -0
      pages/spellDetail/index.js
  4. +4
    -0
      pages/spellDetail/index.json
  5. +2
    -0
      pages/spellDetail/index.wxml
  6. +1
    -0
      pages/spellDetail/index.wxss
  7. +170
    -103
      pages/spellGroup/mySpellGroup/index.js
  8. +1
    -1
      pages/spellGroup/mySpellGroup/index.wxss

+ 2
- 1
app.json Просмотреть файл

@@ -49,7 +49,8 @@
"pages/paySuccess/paySuccess", "pages/paySuccess/paySuccess",
"pages/ConsumeDetail/ConsumeDetail", "pages/ConsumeDetail/ConsumeDetail",
"pages/externallinks/index", "pages/externallinks/index",
"pages/czdetail/czdetail"
"pages/czdetail/czdetail",
"pages/spellDetail/index"
], ],
"navigateToMiniProgramAppIdList": [ "navigateToMiniProgramAppIdList": [
"wx192b7d2e8dcbefd0", "wx192b7d2e8dcbefd0",


+ 9
- 1
config/config.js Просмотреть файл

@@ -239,7 +239,15 @@ var config = {
/** /**
* *分页列表接口 * *分页列表接口
*/ */
merchantList:"/merchant/list"
merchantList:"/merchant/list",
/*
* 查询拼团状态
*/
queryOrderGroupStatus:'/orderGroup/queryOrderGroupStatus',
/**
* 去拼团
*/
toOrderGroup: '/orderGroup/toOrderGroup'
}, },
weapp: { weapp: {
AppId: weappId AppId: weappId


+ 66
- 0
pages/spellDetail/index.js Просмотреть файл

@@ -0,0 +1,66 @@
// pages/spellDetail/index.js
Page({

/**
* 页面的初始数据
*/
data: {

},

/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {

},

/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady: function () {

},

/**
* 生命周期函数--监听页面显示
*/
onShow: function () {

},

/**
* 生命周期函数--监听页面隐藏
*/
onHide: function () {

},

/**
* 生命周期函数--监听页面卸载
*/
onUnload: function () {

},

/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh: function () {

},

/**
* 页面上拉触底事件的处理函数
*/
onReachBottom: function () {

},

/**
* 用户点击右上角分享
*/
onShareAppMessage: function () {

}
})

+ 4
- 0
pages/spellDetail/index.json Просмотреть файл

@@ -0,0 +1,4 @@
{
"navigationBarTitleText": "拼团详情",
"usingComponents": {}
}

+ 2
- 0
pages/spellDetail/index.wxml Просмотреть файл

@@ -0,0 +1,2 @@
<!--pages/spellDetail/index.wxml-->
<text>pages/spellDetail/index.wxml</text>

+ 1
- 0
pages/spellDetail/index.wxss Просмотреть файл

@@ -0,0 +1 @@
/* pages/spellDetail/index.wxss */

+ 170
- 103
pages/spellGroup/mySpellGroup/index.js Просмотреть файл

@@ -45,6 +45,7 @@ Page({
this.setData({ this.setData({
canBuyIf: false canBuyIf: false
}) })
this.orderFunc()
}, },
/** /**
* 发起拼团 * 发起拼团
@@ -54,7 +55,7 @@ Page({
this.setData({ this.setData({
canSpell:false canSpell:false
}) })
this.orderFunc()
this.orderFunc(0)
}, },
/** /**
* 获取一个拼团信息 * 获取一个拼团信息
@@ -74,6 +75,35 @@ Page({
} }
}); });
}, },
countdown(end_time) {
let that = this;
var EndTime = end_time;
var NowTime = new Date().getTime();
var total_micro_second = EndTime - NowTime || [];
// 渲染倒计时时钟
let obj = that.dateformat(total_micro_second);
if (total_micro_second > 0) {
that.setData({
clock: obj,
day: obj.a1,
hour: obj.b1,
min: obj.c1,
sec: obj.d1,
})
} else {
that.setData({
clock: "00",
day: "00",
hour: "00",
min: "00",
sec: "00",
})
}
setTimeout(function () {
total_micro_second -= 1000;
that.countdown(end_time);
}, 1000)
},
/** /**
* 获取券详情信息 * 获取券详情信息
*/ */
@@ -93,10 +123,72 @@ Page({
}); });
}); });
}, },
/**
* 去拼团
*/
goToOrderGroup(orderId, orderGroupId, _this){
console.log(22222222)
let that = this;
// 支付成功
Http.post({
url: config.api.toOrderGroup,
data: {
id: orderGroupId,
orderId,
couponId: _this.data.data.couponId
}
})
.then(res => {

})
.catch(err => {
console.log(err);
})
// return;
// wx.navigateTo({
// url: `/pages/spellDetail/index?orderId=${orderId}&couponId=${_this.data.data.couponId}`
// });
},
/**
* 支付订单更新
*/
payOrderUpdate: (orderId, payOrderId, status, reason, _this, orderGroupId) => {
let that = this;
// 支付成功
Http.post({
url: config.api.payOrderUpdate,
data: {
payOrderId: payOrderId,
orderId: orderId,
status: status,
reason: reason
}
})
.then(res => {
wx.hideLoading()
_this.goToOrderGroup(orderId, res.data.orderGroupId, _this)
})
.catch(err => {
console.log(err);
setTimeout(function () {
_this.payOrderUpdate(orderId, payOrderId, status, reason, _this, orderGroupId);
}, 2000)
})
},
/** /**
* 发起支付 * 发起支付
*/ */
orderFunc(discount) {
orderFunc(orderGroupId) {
let data = {
couponChannelId: this.data.data.id,
couponId: this.data.data.couponId
}
/**
* 拼团订单
*/
if (orderGroupId==0){
data.orderGroupId = orderGroupId
}
var that = this; var that = this;
Http.post({ Http.post({
url: config.api.checkPhoneStatus, url: config.api.checkPhoneStatus,
@@ -106,11 +198,10 @@ Page({
/** /**
* orderSave 下单 * orderSave 下单
*/ */
debugger
// return Http.post({
// url: config.api.orderSave,
// data: data
// });
return Http.post({
url: config.api.orderSave,
data: data
});
}) })
.catch(err => { .catch(err => {
console.log(err); console.log(err);
@@ -200,106 +291,82 @@ Page({
}) })
.then(res => { .then(res => {
console.log(res) console.log(res)
if (discount != 'discount') {
if (typeof (res) != "undefined") {
let orderId = "" + res.data.id;
that.setData({
if (typeof (res) != "undefined") {
let orderId = "" + res.data.id;
that.setData({
orderId: orderId
});
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId orderId: orderId
});
if (res.data.payment > 0) {
// 支付金额不为0
/**
* 支付订单创建
*/
Http.post({
url: config.api.payOrderCreate,
data: {
orderId: orderId
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
wx.showLoading({
title: '订单正在处理中...',
})
setTimeout(function () {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function () {
wx.hideLoading();
}, 2000);
/**
* 用户支付成功以后跳转到券包列表
*/
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
})
} else if (that.data.data.type != 5) {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
})
}
}
},
fail: res => {
/**
* 支付失败,需要更新订单的状态
*/
that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
that.setData({
showbutton: false
})
return;
},
complete: res => { }
});
/// End payment --------
})
.catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
} else {
console.log(that.data.type)
// 免费券
that.payOrderUpdate(orderId, "0", 1, '', 'free');
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
}
})
.then(res => {
var payOrderId = "" + res.data.payOrderId;
wx.hideLoading();
wx.requestPayment({
timeStamp: res.data.timeStamp,
nonceStr: res.data.nonceStr,
package: res.data.package,
signType: (res.data.signType) ? res.data.signType : "MD5",
paySign: res.data.paySign,
success: res => {
wx.showLoading({
title: '订单正在处理中...',
}) })
} else if (that.data.data.type != "5") {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
setTimeout(function () {
wx.hideLoading()
}, 5000)
that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', that, orderGroupId);
if (res.errMsg == "requestPayment:ok") {
setTimeout(function () {
wx.hideLoading();
}, 2000);
/**
* 用户支付成功以后跳转到券包列表
*/
if (that.data.cardType == 100) {
wx.setStorage({
key: 'couponNum2',
data: "couponNum2"
})
} else if (that.data.data.type != 5) {
wx.setStorage({
key: 'couponNum',
data: "couponNum"
})
}
}
},
fail: res => {
/**
* 支付失败,需要更新订单的状态
*/
that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', that, orderGroupId);
that.setData({
showbutton: false
}) })
}
}
}
} else {
if (res) {
wx.navigateTo({
url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.id}`,
})
}
return;
},
complete: res => { }
});
/// End payment --------
})
.catch(err => {
wx.showToast({
title: err.message,
icon: 'none',
duration: 2000,
mask: false
});
})
} }
}) })
}, },
/** /**


+ 1
- 1
pages/spellGroup/mySpellGroup/index.wxss Просмотреть файл

@@ -62,7 +62,7 @@
font-weight:500; font-weight:500;
color:rgba(0,0,0,1); color:rgba(0,0,0,1);
line-height:44rpx; line-height:44rpx;
margin-right: 30rpx;
margin-right: 15rpx;
} }
.des-saleprice{ .des-saleprice{
display: inline; display: inline;


Загрузка…
Отмена
Сохранить