diff --git a/api/interfaces/user.js b/api/interfaces/user.js
index 0d0d979..3e3a9e0 100644
--- a/api/interfaces/user.js
+++ b/api/interfaces/user.js
@@ -53,7 +53,10 @@ const unicom = (mobile, channel, code) => req({url: "unicom/get", method: "POST"
const merchant_card = (coupon_id) => req({url: "coupons/merchant_card", method: "GET", data:{coupon_id : coupon_id}})
// 获取商家券信息
-const washcarBuy = () => req({url: "washcar/create"})
+const washcarBuy = (welfare_id, right_id, qty, address_id) => req({url: "washcar/create", data:{welfare_id : welfare_id, right_id : right_id, qty : qty, address_id : address_id || ''}})
+
+// 收银台提交
+const washcarCreate = (welfare_id, right_id, qty, address_id, is_deliver) => req({url: "washcar/create", method: "POST", data:{welfare_id : welfare_id, right_id : right_id, qty : qty, address_id : address_id || '', is_deliver : is_deliver}})
export default({
index,
@@ -73,5 +76,6 @@ export default({
send,
unicom,
merchant_card,
- washcarBuy
+ washcarBuy,
+ washcarCreate
})
diff --git a/pages/car/index.js b/pages/car/index.js
index 9b12f68..401d12e 100644
--- a/pages/car/index.js
+++ b/pages/car/index.js
@@ -8,15 +8,42 @@ Page({
* 页面的初始数据
*/
data: {
-
+ rightId : '', //权益id
+ welfareId : '', //活动id
+ address : '', //默认地址
+ allAddress : '', //收货地址列表
+ detail : '', //权益详情
+ amount : '', //总金额
+ moreAmount : '', //产品金额
+ platIndex : 0, //选择提交方式下标
+ isdeliver : -1,
+ platformCp : [], //选择提交数组
+ num : 1, //购买的数量
+ content : '', //内容介绍
+ notification: '', //重要提示
+ remark : '', //使用须知
+ score : '', //应付总积分
+ freight : '', //运费
+ noticeShow : false, //须知显示状态
+ addressShow : false, //收货地址显示
+ payWayIndex : 0,
+ payWay :[
+ {value: 0, name: "微信支付"}
+ // {value: 1, name: "沃钱包支付"}
+ ]
},
/**
* 生命周期函数--监听页面加载
*/
onLoad (options) {
- console.log(options)
- // this.couponInfo()
+ this.setData({
+ rightId : options.right_id,
+ welfareId: options.welfare_id
+ })
+
+ // 获取卡券列表
+ this.couponInfo()
},
/**
@@ -30,8 +57,243 @@ Page({
* 卡券列表
*/
couponInfo() {
- wx.$api.user.washcarBuy().then(res=>{
- console.log(res)
+ wx.$api.user.washcarBuy(this.data.welfareId, this.data.rightId, this.data.num, this.data.address.id).then(res=>{
+ let obj = res.data.detail.express
+ let defGet = res.data.detail.def_get
+ let arr = new Array
+ arr = Object.keys(obj).map(val=>{
+ return { ...obj[val], ...{key: val} }
+ })
+
+ if(this.data.isdeliver == -1){
+ if(res.data.detail.type == 'physical') {
+ this.setData({
+ isdeliver : res.data.detail.def_get
+ })
+ }
+ if(res.data.detail.type == 'virtual') this.setData({isdeliver : 1})
+ }
+
+ this.setData({
+ address : res.data.address,
+ allAddress : res.data.all_address,
+ detail : res.data.detail,
+ num : res.data.qty,
+ freight : res.data.freight,
+ platformCp : arr,
+ amount : res.data.total,
+ moreAmount : res.data.amount,
+ score : res.data.score,
+ remark : res.data.detail.remark.replace(/\
{
+ if(!err.login){
+ wx.showModal({
+ title : '用户登录已过期',
+ content : '请重新登录',
+ showCancel : false,
+ success : res => {
+ if (res.confirm) {
+ wx.redirectTo({
+ url: '/pages/login/login'
+ })
+ }
+ }
+ })
+ }
+ })
+ },
+
+ /**
+ * 须知展开收起状态
+ */
+ noticeTap() {
+ this.setData({
+ noticeShow : !this.data.noticeShow
+ })
+ },
+
+ /**
+ * 收货地址弹出
+ */
+ addressTap() {
+ this.setData({
+ addressShow : !this.data.addressShow
+ })
+ },
+
+ /**
+ * 选择收货地址
+ */
+ selectAddress(e){
+ let new_addressId = e.currentTarget.dataset.id,
+ addressId = this.data.address.id
+ if (new_addressId != addressId) {
+ this.setData({
+ address : e.currentTarget.dataset.index,
+ addressShow : false
+ })
+ }else{
+ this.setData({
+ addressShow : false
+ })
+ }
+
+ // 获取卡券列表
+ this.couponInfo()
+ },
+
+ /**
+ * 支付选择
+ */
+ payBind(e) {
+ this.setData({
+ payWayIndex: e.detail.value
+ })
+ },
+
+ /**
+ * 商品数量加减
+ */
+ goodsNumber(e){
+ let num = this.data.num
+ if (e.currentTarget.dataset.type == 'plus'){
+ num ++;
+ }else{
+ if (num > 1){
+ num --;
+ }else{
+ wx.showToast({
+ title : '商品数量不能小于1',
+ icon : 'none'
+ })
+ }
+ }
+ this.setData({
+ num : num
+ })
+
+ // 获取详情
+ this.couponInfo()
+ },
+
+ /**
+ * 选择提交方式
+ */
+ platBind(e) {
+ this.setData({
+ platIndex : e.detail.value,
+ isdeliver : this.data.platformCp[e.detail.value].value
+ })
+ // 获取详情
+ this.couponInfo()
+ },
+
+ /**
+ * 支付提交
+ */
+ submitOrder() {
+ if(this.data.isdeliver.length == 0) {
+ this.setData({
+ isdeliver: this.data.detail.def_get
+ })
+ }
+ let right_id = this.data.rightId,
+ welfare_id = this.data.welfareId,
+ address_id = this.data.address.id,
+ is_deliver = this.data.isdeliver,
+ qty = this.data.num
+
+ wx.$api.user.washcarCreate(welfare_id, right_id, qty, address_id, is_deliver).then(res=>{
+ let dataUrl = '', //定义接口来源名称
+ type = res.data.type //订单来源
+ // welfare为福利活动购买
+ if(type == 'welfare') dataUrl = wx.$api.index.fridayInfo(welfare_id, address_id, is_deliver)
+
+ // right为权益购买
+ if(type == 'right') dataUrl = wx.$api.index.rightStore(right_id, address_id, is_deliver, qty)
+
+ // 第一步接口调取
+ dataUrl.then(dataRes=>{
+ let payUrl = '', //定义接口来源名称
+ Newtype = dataRes.data.type //订单来源
+ // welfare为福利活动购买
+ if(Newtype == 'welfare') payUrl = wx.$api.index.fridayPay(dataRes.data.trade_no)
+
+ // right为权益购买
+ if(Newtype == 'right') payUrl = wx.$api.index.wechat(dataRes.data.trade_no)
+
+ // 第一步接口调取
+ payUrl.then(payEes=>{
+ let payInfo = JSON.parse(payEes.data)
+ wx.requestPayment({
+ timeStamp: payInfo.timeStamp,
+ nonceStr : payInfo.nonceStr,
+ package : payInfo.package,
+ paySign : payInfo.paySign,
+ signType : payInfo.signType,
+ success : res=>{
+ if(res.errMsg == "requestPayment:ok"){
+ wx.showToast({
+ title: '支付成功',
+ icon : 'success'
+ })
+ if(Newtype == 'welfare'){
+ setTimeout(()=>{
+ if(this.data.isdeliver == 1) {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=welfareGoods'
+ })
+ } else {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=welfare'
+ })
+ }
+ },3000)
+ }
+ if(Newtype == 'right'){
+ setTimeout(()=>{
+ if(this.data.isdeliver == 1) {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=rightsCoupons'
+ })
+ } else {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=rights'
+ })
+ }
+ },3000)
+ }
+ }
+ },
+ fail : res=>{
+ if(Newtype == 'welfare'){
+ if(this.data.isdeliver == 1) {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=welfareGoods&stateType=unpay'
+ })
+ } else {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=welfare&stateType=unpay'
+ })
+ }
+ }
+ if(Newtype == 'right'){
+ if(this.data.isdeliver == 1) {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=rightsCoupons&stateType=unpay'
+ })
+ } else {
+ wx.reLaunch({
+ url: '/pages/order/order?orderType=rights&stateType=unpay'
+ })
+ }
+ }
+ }
+ })
+ })
+ })
})
}
})
\ No newline at end of file
diff --git a/pages/car/index.wxml b/pages/car/index.wxml
index 1065238..8c1e3e1 100644
--- a/pages/car/index.wxml
+++ b/pages/car/index.wxml
@@ -1,2 +1,172 @@
-
-pages/car/index.wxml
+
+
+
+ 等待买家付款
+ 请您尽快下单购买
+
+
+
+
+
+
+
+
+
+
+
+ {{address.name}} {{address.mobile}}
+
+ {{address.all_address}}
+
+
+
+
+ 暂无收货地址
+
+
+
+
+
+
+
+
+ {{detail.type == 'virtual' ? '券' : '实'}}
+
+
+
+
+ {{detail.title}}
+
+
+ 数量:x{{num}}
+
+
+
+
+
+
+
+
+
+ {{detail.attribute.form_price}}
+
+
+ ¥{{moreAmount}}
+
+
+
+ {{detail.attribute.form_type}}
+ ¥{{score}}
+
+
+ {{detail.attribute.form_pay}}
+ ¥{{amount}}
+
+
+
+ 运费
+
+
+ ¥{{freight}}
+
+
+
+
+
+
+
+
+ 购买数量
+
+
+ -
+ {{num}}
+ +
+
+
+
+
+
+
+
+ 请选择提交方式
+
+
+
+ {{platformCp[platIndex].name}}
+
+
+
+
+
+
+
+
+
+
+ 请选择支付方式
+
+
+
+ {{payWay[payWayIndex].name}}
+
+
+
+
+
+
+ 支付方式
+ {{payWay[payWayIndex].name}}
+
+
+
+
+
+
+
+
+ 购买前请仔细阅读使用须知、内容介绍
+
+
+
+
+ 购买须知
+
+
+
+
+ 内容介绍
+
+
+
+
+
+
+
+
+
+ 实际付款¥{{amount}}
+ 立即购买
+
+
+
+
+
+
+ 请选择收货地址
+ 新增收货地址
+
+
+
\ No newline at end of file
diff --git a/pages/car/index.wxss b/pages/car/index.wxss
index 367ebdc..207d27e 100644
--- a/pages/car/index.wxss
+++ b/pages/car/index.wxss
@@ -1 +1,448 @@
-/* pages/car/index.wxss */
\ No newline at end of file
+/* 下单状态 */
+.state {
+ background: #2e71e3;
+ padding: 30rpx 100rpx 60rpx;
+ width: 100%;
+ box-sizing: border-box;
+ color: #fff;
+ font-size: 26rpx;
+ display: flex;
+}
+
+.state-title {
+ flex: 1;
+ font-size: 32rpx;
+}
+
+.state-title text {
+ opacity:.8;
+ display: block;
+ font-size: 28rpx;
+ margin-top: 10rpx;
+}
+
+.state-img {
+ width: 70rpx;
+ height: 70rpx;
+ margin-top: 10rpx;
+}
+
+/* 默认地址 */
+.content {
+ padding: 0 30rpx;
+ box-sizing: border-box;
+ width: 100%;
+ border-bottom: solid transparent 120rpx;
+}
+
+.site {
+ background-color: #fff;
+ margin-top: -30rpx;
+ border-radius: 10rpx;
+ padding: 30rpx;
+ box-sizing: border-box;
+ box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
+}
+
+.siteTips {
+ text-align: center;
+}
+
+.siteTips-tips {
+ color: #2e71e3;
+ border: #2e71e3 2rpx solid;
+ display: inline-block;
+ font-size: 28rpx;
+ line-height: 70rpx;
+ padding: 0 20rpx;
+ text-align: center;
+ margin: 0 auto;
+}
+
+.siteTips-tips image {
+ width: 32rpx;
+ height: 32rpx;
+ vertical-align: -5rpx;
+ padding-right: 10rpx;
+}
+
+.siteCont {
+ display: flex;
+ position: relative;
+}
+
+.siteCont-right {
+ width: calc(100% - 70rpx);
+ margin-left: 30rpx;
+}
+
+.state-arrow {
+ position: absolute;
+ right: 0;
+ top: 24rpx;
+ width: 34rpx;
+ height: 34rpx;
+}
+
+.siteCont-site {
+ width: 40rpx;
+ height: 40rpx;
+ margin-top: 24rpx;
+}
+
+.site-text {
+ margin-bottom: 10rpx;
+}
+
+.site-text text {
+ padding-left: 10rpx;
+ color: #999;
+ font-size: 28rpx;
+}
+
+.site-all {
+ font-size: 26rpx;
+}
+
+.goods {
+ width: 100%;
+ background-color: #fff;
+ border-radius: 10rpx;
+ padding: 30rpx;
+ box-sizing: border-box;
+ box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
+ margin: 30rpx 0;
+}
+
+.goods-content {
+ position: relative;
+}
+
+.goods-cont {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ padding-left: 150rpx;
+ box-sizing: border-box;
+}
+
+.goods-title {
+ margin: 10rpx 0 20rpx;
+ font-weight: 600;
+ font-size: 30rpx;
+}
+
+.goods-qty {
+ color: #999;
+ font-size: 28rpx;
+}
+
+.goods-cover {
+ position: relative;
+ width: 130rpx;
+ height: 130rpx;
+}
+
+.goods-image {
+ position: absolute;
+ left: 0;
+ top: 0;
+ width: 100%;
+ height: 100%;
+}
+
+.goods-type {
+ position: absolute;
+ z-index: 2;
+ left: 15rpx;
+ top: 15rpx;
+ font-size: 24rpx;
+ background-color: #5d69fb;
+ color: #fff;
+ border-radius: 50rpx;
+ height: 36rpx;
+ line-height: 34rpx;
+ padding: 0 6rpx;
+}
+
+.goods-type.active {
+ background-color: #fb5d64;
+}
+
+.goods-type text {
+ transform: scale(.9);
+ display: inline-block;
+}
+
+/* 规格 */
+.label {
+ background-color: #fff;
+ border-radius: 10rpx;
+ padding: 10rpx 30rpx;
+ width: 100%;
+ box-sizing: border-box;
+ box-shadow: 0 0 10rpx rgba(0, 0, 0, .1);
+ margin-bottom: 30rpx;
+ position: relative;
+}
+
+.labelList {
+ display: flex;
+ line-height: 80rpx;
+ font-size: 28rpx;
+}
+
+.labelList-label {
+ flex: 1;
+}
+
+.rightsLabel-range {
+ display: flex;
+ color: #000;
+}
+
+.rightsLabel-row {
+ width: 38rpx;
+ height: 38rpx;
+ margin: 20rpx 0 0 6rpx;
+}
+
+.rightsAdd {
+ display: flex;
+ padding-top: 14rpx;
+}
+
+.rightsAdd-btn {
+ background: #eaeaea;
+ color: #535353;
+ border-radius: 50%;
+ text-align: center;
+ width: 50rpx;
+ height: 50rpx;
+ line-height: 45rpx;
+ font-size: 40rpx;
+ font-weight: 600;
+}
+
+.rightsAdd-input {
+ width: 60rpx;
+ text-align: center;
+ font-size: 28rpx;
+ line-height: 50rpx;
+}
+
+/* 购买 */
+.buy {
+ position: fixed;
+ width: 100%;
+ left: 0;
+ bottom: 0;
+ height: 100rpx;
+ line-height: 100rpx;
+ background-color: #fff;
+}
+
+.buy-price {
+ background-color: #f1cb4c;
+ color: #8d5226;
+ width: calc(100% - 240rpx);
+ position: absolute;
+ left: 0;
+ top: 0;
+ height: 100%;
+ padding-left: 50rpx;
+ box-sizing: border-box;
+ font-weight: 600;
+ font-size: 32rpx;
+}
+
+.buy-price text {
+ font-size: 42rpx;
+}
+
+.buy .buy-btn {
+ background-color: #2e71e3;
+ color: #fff;
+ position: absolute;
+ right: 0;
+ top: 0;
+ width: 240rpx;
+ text-align: center;
+ height: 100%;
+}
+
+/* 购买须知 */
+.notice {
+ background: white;
+ margin: 30rpx 0;
+ border-radius: 10rpx;
+ padding: 10rpx 0;
+ box-sizing: border-box;
+ box-shadow: 0 0 30rpx rgba(0,0,0,.15);
+ padding: 20rpx;
+}
+
+.noticeTitle {
+ display: flex;
+}
+
+.noticeTitle-flex {
+ flex: 1;
+ display: flex;
+ font-size: 28rpx;
+ line-height: 46rpx;
+}
+
+.noticeTitle-img {
+ width: 46rpx;
+ height: 46rpx;
+ margin-right: 20rpx;
+}
+
+.noticeText {
+ font-size: 26rpx;
+ height: 0;
+ overflow: hidden;
+}
+
+.noticeText.active {
+ height: auto;
+}
+
+.noticeText-top {
+ margin: 30rpx 0 10rpx;
+ font-weight: 600;
+}
+
+.noticeText-cont {
+ line-height: 60rpx;
+}
+
+.noticeTitle-row {
+ width: 46rpx;
+ height: 46rpx;
+}
+
+.noticeTitle-row.active {
+ transform: rotate(90deg);
+}
+
+/* 选择收货地址 */
+.addressBack {
+ position: fixed;
+ left: 0;
+ bottom: 0;
+ background: rgba(0, 0, 0, .4);
+ z-index: 10;
+ width: 100%;
+ height: 100%;
+ display: none;
+}
+
+.addressBack.active {
+ display: block;
+}
+
+.addressCont {
+ position: fixed;
+ left: 0;
+ bottom: -1000%;
+ transition: .2s;
+ background: #fff;
+ z-index: 11;
+ width: 100%;
+}
+
+.addressCont.active {
+ bottom: 0;
+}
+
+.addressCont-title {
+ height: 90rpx;
+ line-height: 90rpx;
+ display: flex;
+ padding: 0 30rpx;
+ box-sizing: border-box;
+ font-size: 28rpx;
+ font-weight: 600;
+}
+
+.addressCont-left {
+ flex: 1;
+}
+
+.addressCont-right {
+ color: #309ded;
+}
+
+.header-classify {
+ white-space: nowrap;
+ box-sizing: border-box;
+ height: 600rpx;
+}
+
+.addressCont-list {
+ padding: 30rpx 20rpx;
+ box-sizing: border-box;
+ font-size: 30rpx;
+ overflow: hidden;
+ position: relative;
+}
+
+.addressCont-top {
+ display: flex;
+ margin-bottom: 10rpx;
+}
+
+.addressCont-name {
+ font-weight: 600;
+}
+
+.addressCont-text {
+ color: #666;
+ width: calc(100% - 160rpx);
+}
+
+.addressCont-list:last-child {
+ border: none;
+}
+
+.address-tool {
+ display: flex;
+ float: right;
+}
+
+.address-tool-btn {
+ font-size: 24rpx;
+ margin-top: 20rpx;
+ border: 2rpx solid #666;
+ color: #666;
+ border-radius: 6rpx;
+ text-align: center;
+ height: 50rpx;
+ line-height: 50rpx;
+ padding: 0 20rpx;
+ margin-right: 20rpx;
+ display: flex;
+}
+
+.address-tool-btn-del {
+ color: #dfae2e;
+ border-color: #dfae2e;
+}
+
+.address-tool-icon {
+ width: 120rpx;
+ height: 54rpx;
+ line-height: 54rpx;
+ border-radius: 4rpx;
+ text-align: center;
+ color: #fff;
+ position: absolute;
+ top: 45rpx;
+ right: 10rpx;
+ background: #dfae2e;
+ transform: scale(.9, .9);
+ font-size: 24rpx;
+}
\ No newline at end of file
diff --git a/pages/order/order.js b/pages/order/order.js
index dbfaf24..aa77f57 100644
--- a/pages/order/order.js
+++ b/pages/order/order.js
@@ -26,6 +26,8 @@ Page({
orderType: options.orderType,
stateType: options.stateType
})
+
+ console.log(options.orderType)
},
onShow() {
diff --git a/pages/rights/rights.js b/pages/rights/rights.js
index 461f4ef..b40a71d 100644
--- a/pages/rights/rights.js
+++ b/pages/rights/rights.js
@@ -118,11 +118,11 @@ Page({
content : '请重新登录',
showCancel : false,
success : res => {
- if (res.confirm) {
- wx.redirectTo({
- url: '/pages/login/login'
- })
- }
+ if (res.confirm) {
+ wx.redirectTo({
+ url: '/pages/login/login'
+ })
+ }
}
})
}
diff --git a/static/img/carSite_add.png b/static/img/carSite_add.png
new file mode 100644
index 0000000..9bed061
Binary files /dev/null and b/static/img/carSite_add.png differ
diff --git a/static/img/car_site.png b/static/img/car_site.png
new file mode 100644
index 0000000..b89756b
Binary files /dev/null and b/static/img/car_site.png differ
diff --git a/static/img/car_state.png b/static/img/car_state.png
new file mode 100644
index 0000000..bddedea
Binary files /dev/null and b/static/img/car_state.png differ