Commit 6674fe67 by 严立

退款流程

parent e262f568
...@@ -274,6 +274,7 @@ App({ ...@@ -274,6 +274,7 @@ App({
let funcShopInfo = JSON.parse(JSON.stringify(iEnvironmental.shopId[i])) let funcShopInfo = JSON.parse(JSON.stringify(iEnvironmental.shopId[i]))
if (funcShopType) funcShopInfo.shopType = funcShopType if (funcShopType) funcShopInfo.shopType = funcShopType
console.log('11')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
return iEnvironmental.shopId[i] return iEnvironmental.shopId[i]
} }
......
...@@ -4,44 +4,23 @@ Component({ ...@@ -4,44 +4,23 @@ Component({
scrollLock: false, scrollLock: false,
properties: { properties: {
// tab 整体样式 listOption: {
classTab: { type: Object,
type: String, value: {}
value: 'm-tab-container',
}, },
itemOption: {
// tab 列表样式 type: Object,
classTabList: { value: {
type: String, align: 'between', // 左对齐 - left,居中对齐 - center,右对齐 - right,两侧对齐 - between,等分对齐 - around
value: 'm-tab-list', }
},
// tab 列表项目样式
classTabItem: {
type: String,
value: 'm-item',
},
// 点击样式
classActive: {
type: String,
value: 'm-item-active',
},
// 默认样式
classInactive: {
type: String,
value: 'm-item-inactive',
}, },
item: { item: {
type: Array, type: Array,
value: [] value: []
}, },
activeIndex: { activeIndex: {
type: Number, type: Number,
value: 0, value: 0
}, },
}, },
...@@ -61,7 +40,6 @@ Component({ ...@@ -61,7 +40,6 @@ Component({
setItemElement: function () { setItemElement: function () {
if (this.data.item.length === 0) return if (this.data.item.length === 0) return
// 获取购物车高度
let funcQuery = this.createSelectorQuery() let funcQuery = this.createSelectorQuery()
funcQuery.selectAll('.m-item-mark').boundingClientRect() funcQuery.selectAll('.m-item-mark').boundingClientRect()
funcQuery.exec((funcResult) => { funcQuery.exec((funcResult) => {
...@@ -87,30 +65,5 @@ Component({ ...@@ -87,30 +65,5 @@ Component({
}) })
this.triggerEvent('tabChange', Object.assign(funcItem, { index: funcIndex })) this.triggerEvent('tabChange', Object.assign(funcItem, { index: funcIndex }))
}, },
eventTabScroll: function (funcEvent) {
if (this.scrollLock) return
let funcScrollLeft = funcEvent.detail.scrollLeft
clearTimeout(this.scrollTimer)
this.scrollTimer = setTimeout(() => {
let funcItemElementLeft = this.data.itemElementLeft
for (let i = 0, l = funcItemElementLeft.length; i < l; i++) {
// funcScrollLeft - 20 是为了弥补滚动到首个 item 时无法准确定位在 0 数值上的问题。
if (funcScrollLeft - 20 < funcItemElementLeft[i]) {
this.scrollLock = true
this.setData({
scrollLeft: funcItemElementLeft[i]
})
clearTimeout(this.scrollTimer)
this.scrollTimer = setTimeout(() => {
this.scrollLock = false
clearTimeout(this.scrollTimer)
}, 500)
break
}
}
}, 200)
},
} }
}) })
<view class="m-tab {{classTab}}"> <view class="m-tab m-tab-container">
<view class="{{classTabList}}"> <view class="m-tab-list">
<block wx:for="{{item}}" wx:for-item="item" wx:for-index="index" wx:key="index"> <block wx:for="{{item}}" wx:for-item="item" wx:for-index="index" wx:key="index">
<view class="m-item-mark {{classTabItem}}" data-item="{{item}}" data-index="{{index}}" bindtap="onItem"> <view class="m-item-mark m-item" data-item="{{item}}" data-index="{{index}}" bindtap="onItem">
<view class="row cc ac {{classActive}}" wx:if="{{activeIndex === index}}"> <view class="row cc ac m-item-active" wx:if="{{activeIndex === index}}">
<text>{{item.text}}</text> <text>{{item.text}}</text>
</view> </view>
<view class="row cc ac {{classInactive}}" wx:if="{{activeIndex !== index}}"> <view class="row cc ac m-item-inactive" wx:if="{{activeIndex !== index}}">
<text>{{item.text}}</text> <text>{{item.text}}</text>
</view> </view>
</view> </view>
......
...@@ -46,6 +46,7 @@ Page({ ...@@ -46,6 +46,7 @@ Page({
'shopType': funcShopType, 'shopType': funcShopType,
'commodityLogo': funcShopId[i].commodityLogo 'commodityLogo': funcShopId[i].commodityLogo
} }
console.log('44')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break break
} }
...@@ -173,6 +174,7 @@ Page({ ...@@ -173,6 +174,7 @@ Page({
'shopType': funcShopType, 'shopType': funcShopType,
'commodityLogo': funcShopId[i].commodityLogo 'commodityLogo': funcShopId[i].commodityLogo
} }
console.log('55')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break break
} }
......
...@@ -46,6 +46,7 @@ Page({ ...@@ -46,6 +46,7 @@ Page({
'shopType': funcShopType, 'shopType': funcShopType,
'commodityLogo': funcShopId[i].commodityLogo 'commodityLogo': funcShopId[i].commodityLogo
} }
console.log('22')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break break
} }
...@@ -173,6 +174,7 @@ Page({ ...@@ -173,6 +174,7 @@ Page({
'shopType': funcShopType, 'shopType': funcShopType,
'commodityLogo': funcShopId[i].commodityLogo 'commodityLogo': funcShopId[i].commodityLogo
} }
console.log('33')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break break
} }
......
...@@ -30,6 +30,7 @@ Page({ ...@@ -30,6 +30,7 @@ Page({
}, },
onShow: function () { onShow: function () {
wx.removeStorageSync('shopInfoBuffer')
this.setData({ appStatus: App.globalData.appStatus }) this.setData({ appStatus: App.globalData.appStatus })
this.setData({ this.setData({
userInfo: wx.getStorageSync('userInfo'), userInfo: wx.getStorageSync('userInfo'),
...@@ -374,6 +375,7 @@ Page({ ...@@ -374,6 +375,7 @@ Page({
'shopType': funcShopType, 'shopType': funcShopType,
'commodityLogo': funcShopId[i].commodityLogo 'commodityLogo': funcShopId[i].commodityLogo
} }
console.log('66')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break break
} }
......
...@@ -110,6 +110,7 @@ Page({ ...@@ -110,6 +110,7 @@ Page({
}, },
setShopInfo: function () { setShopInfo: function () {
console.log('this.data.option', this.data.option)
if (this.data.option.formPage === 'order') { if (this.data.option.formPage === 'order') {
let funcAppId = Number(this.data.option.shopAppId) let funcAppId = Number(this.data.option.shopAppId)
for (let i = 0, l = App.globalData.shopId.length; i < l; i++) { for (let i = 0, l = App.globalData.shopId.length; i < l; i++) {
...@@ -122,6 +123,7 @@ Page({ ...@@ -122,6 +123,7 @@ Page({
'shopType': Number(this.data.option.commodityType) 'shopType': Number(this.data.option.commodityType)
} }
console.log('77')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break break
} }
......
...@@ -319,6 +319,7 @@ Page({ ...@@ -319,6 +319,7 @@ Page({
let funcCommodityInfo = this.data.shopCommodityData[funcIndex][funcItemIndex] let funcCommodityInfo = this.data.shopCommodityData[funcIndex][funcItemIndex]
let funcShopInfo = App.setShopInfo(this.data.shopAppId[funcIndex].appId) let funcShopInfo = App.setShopInfo(this.data.shopAppId[funcIndex].appId)
funcShopInfo.shopType = Number(funcCommodityInfo.typeId) funcShopInfo.shopType = Number(funcCommodityInfo.typeId)
console.log('88')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
// 补充必要参数 // 补充必要参数
...@@ -343,6 +344,7 @@ Page({ ...@@ -343,6 +344,7 @@ Page({
App.setShopInfo(7) App.setShopInfo(7)
let funcShopInfo = wx.getStorageSync('shopInfoBuffer') let funcShopInfo = wx.getStorageSync('shopInfoBuffer')
funcShopInfo.shopType = 2 funcShopInfo.shopType = 2
console.log('99')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
wx.navigateTo({ wx.navigateTo({
......
...@@ -208,14 +208,6 @@ Page({ ...@@ -208,14 +208,6 @@ Page({
}, },
}) })
.then((response) => { .then((response) => {
if (response.data && response.data.code === 500) {
App.ui.showToast({
iconType: 'error',
title: response.data.message,
})
return
}
App.ui.hideToast() App.ui.hideToast()
this.setData({ this.setData({
appointmentComplete: true, appointmentComplete: true,
......
...@@ -245,7 +245,6 @@ Page({ ...@@ -245,7 +245,6 @@ Page({
App.ui.showToast({ App.ui.showToast({
iconType: 'error', iconType: 'error',
title: '请选购商品后结算', title: '请选购商品后结算',
duration: 30000
}) })
return return
} }
......
...@@ -230,20 +230,12 @@ Page({ ...@@ -230,20 +230,12 @@ Page({
}, },
}) })
.then((response) => { .then((response) => {
if (response.data && response.data.code == 500) { this.setData({
App.ui.showToast({ appointmentComplete: true,
iconType: 'error', })
title: response.data.message, App.ui.hideToast()
})
} else {
this.setData({
appointmentComplete: true,
})
App.ui.hideToast()
}
}) })
.catch((response) => { .catch((response) => {
console.log('response', response)
App.ui.showToast({ App.ui.showToast({
iconType: 'error', iconType: 'error',
title: response.message, title: response.message,
......
...@@ -161,6 +161,38 @@ Page({ ...@@ -161,6 +161,38 @@ Page({
}, 1000) }, 1000)
}, },
onOrderRefund: function () {
App.ui.showDialog({
type: 'confirm',
title: '是否确认申请退款?',
content: '申请后无法撤销',
cancel: '取消',
confirm: '确定',
success: () => {
App.ui.showToast({
'iconType': 'loading',
'title': '处理中',
})
this.setData({
isDoing: true
})
App.request({
url: 'v1/order/orderRefund/' + this.data.orderInfo.id,
method: 'get',
params: {},
})
.then((response) => {
App.ui.showToast({
'iconType': 'success',
'title': '退款申请已提交'
})
this.queryOrderDetail()
})
},
fail: () => {},
})
},
// 再次下单 // 再次下单
onOrderAgain: function () { onOrderAgain: function () {
if (this.data.orderInfo.goodsType === -3) { if (this.data.orderInfo.goodsType === -3) {
......
...@@ -139,7 +139,7 @@ ...@@ -139,7 +139,7 @@
</block> </block>
<!-- 活动 --> <!-- 活动 -->
<block wx:if="{{orderInfo.goodsType === -1}}"> <block wx:if="{{orderInfo.goodsType === -1 || orderInfo.goodsType === -3}}">
<view class="info-content column cc"> <view class="info-content column cc">
<view class="info-content-item row"> <view class="info-content-item row">
<text class="info-content-item-label">报名活动</text> <text class="info-content-item-label">报名活动</text>
...@@ -279,10 +279,11 @@ ...@@ -279,10 +279,11 @@
</view> </view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="footer-btn row ce" wx:if="{{orderInfo.state !== 2}}"> <view class="footer-btn row ce">
<!-- 状态(-1已取消,0未付款,1未发货,2待使用,3已使用,4已过期,5已发货,6已关闭/已评价) --> <!-- 状态(-1已取消,0未付款,1未发货,2待使用,3已使用,4已过期,5已发货,6已关闭/已评价) -->
<view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='0' wx:if="{{orderInfo.state===0}}">取消订单</view> <view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='0' wx:if="{{orderInfo.state===0}}">取消订单</view>
<view class="order-btn" bindtap="onOrderPay" wx:if="{{orderInfo.state===0}}">去支付</view> <view class="order-btn" bindtap="onOrderPay" wx:if="{{orderInfo.state===0}}">去支付</view>
<view class="delete-btn" bindtap="onOrderRefund" data-type='0' wx:if="{{orderInfo.state===2 && orderInfo.goodsType === -1}}">申请退款</view>
<view class="order-btn" bindtap="onOrderEvaluate" wx:if="{{orderInfo.state===3}}">去评价</view> <view class="order-btn" bindtap="onOrderEvaluate" wx:if="{{orderInfo.state===3}}">去评价</view>
<view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='1' wx:if="{{orderInfo.state === 4 || orderInfo.state===-1 || orderInfo.state===6 || orderInfo.state===7}}">删除订单</view> <view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='1' wx:if="{{orderInfo.state === 4 || orderInfo.state===-1 || orderInfo.state===6 || orderInfo.state===7}}">删除订单</view>
<view class="order-btn" wx:if="{{orderInfo.state === -1}}" bindtap="onOrderAgain">再次报名</view> <view class="order-btn" wx:if="{{orderInfo.state === -1}}" bindtap="onOrderAgain">再次报名</view>
......
...@@ -69,36 +69,34 @@ Page({ ...@@ -69,36 +69,34 @@ Page({
}, },
}) })
.then((response) => { .then((response) => {
App.ui.hideToast()
this.setData({ this.setData({
isDoing: false isDoing: false
}) })
if (response.data && response.data.code == 500) { App.ui.showToast({
App.ui.showToast({ 'iconType': 'success',
'iconType': 'error', 'title': '取消成功'
'title': response.data.message, })
}) setTimeout(() => {
} else { let type = this.data.type
App.ui.showToast({ let tabType = 2
'iconType': 'success', if (type == 0) {
'title': '取消成功' //返回夜间入园预约列表
tabType = 1
} else {
// 返回看房预约
tabType = 2
}
wx.redirectTo({
url: '/pages/mine/appointment/appointment?tab=' + tabType,
}) })
setTimeout(() => { }, 2000);
let type = this.data.type })
let tabType = 2 .catch((response) => {
if (type == 0) { App.ui.showToast({
//返回夜间入园预约列表 'iconType': 'error',
tabType = 1 'title': response.message,
} else { })
// 返回看房预约
tabType = 2
}
wx.redirectTo({
url: '/pages/mine/appointment/appointment?tab=' + tabType,
})
}, 2000);
}
}) })
}, },
}) })
......
...@@ -103,6 +103,8 @@ Page({ ...@@ -103,6 +103,8 @@ Page({
'pageNo': this.data.pageNo, 'pageNo': this.data.pageNo,
} }
}).then((response) => { }).then((response) => {
console.log('queryActivityList', response);
App.ui.hideToast() App.ui.hideToast()
let funcData = response.data.list let funcData = response.data.list
...@@ -120,8 +122,11 @@ Page({ ...@@ -120,8 +122,11 @@ Page({
'num': funcData[i].number, 'num': funcData[i].number,
'amount': funcData[i].totalMoney ? funcData[i].totalMoney.toFixed(2) : 0, 'amount': funcData[i].totalMoney ? funcData[i].totalMoney.toFixed(2) : 0,
'wxRequest': funcData[i].wxRequest, 'wxRequest': funcData[i].wxRequest,
'belongType': Number(funcData[i].type) 'belongType': Number(funcData[i].type),
'isRefund': Boolean(Number(funcData[i].enableRefund))
} }
console.log(funcItem);
if (funcItem.status === 3 && funcItem.belongType === 2) funcItem.status = 6 if (funcItem.status === 3 && funcItem.belongType === 2) funcItem.status = 6
funcList.push(funcItem) funcList.push(funcItem)
} }
...@@ -140,6 +145,39 @@ Page({ ...@@ -140,6 +145,39 @@ Page({
this.onOrderDetail(event) this.onOrderDetail(event)
}, },
onOrderRefund: function (event) {
App.ui.showDialog({
type: 'confirm',
title: '是否确认申请退款?',
content: '申请后无法撤销',
cancel: '取消',
confirm: '确定',
success: () => {
App.ui.showToast({
'iconType': 'loading',
'title': '处理中',
})
this.setData({
isDoing: true
})
let funcItem = event.target.dataset.item
App.request({
url: 'v1/order/orderRefund/' + funcItem.orderId,
method: 'get',
params: {},
})
.then((response) => {
App.ui.showToast({
'iconType': 'success',
'title': '退款申请已提交'
})
this.onReload()
})
},
fail: () => {},
})
},
/** /**
* 订单评价 * 订单评价
* @function * @function
...@@ -260,25 +298,23 @@ Page({ ...@@ -260,25 +298,23 @@ Page({
}, },
}) })
.then((response) => { .then((response) => {
App.ui.hideToast() App.ui.showToast({
if (response.data && response.data.code == 500) { 'iconType': 'success',
App.ui.showToast({ 'title': type == 0 ? '取消成功' : '删除成功',
'iconType': 'error', })
'title': response.data.message, setTimeout(() => {
}) this.setData({
} else { 'isDoing': false,
App.ui.showToast({ 'pageNo': 1,
'iconType': 'success',
'title': type == 0 ? '取消成功' : '删除成功',
}) })
setTimeout(() => { this.queryActivityList()
this.setData({ }, 2000);
'isDoing': false, })
'pageNo': 1, .catch((response) => {
}) App.ui.showToast({
this.queryActivityList() 'iconType': 'error',
}, 2000); 'title': response.message,
} })
}) })
}, },
}) })
......
...@@ -74,6 +74,7 @@ ...@@ -74,6 +74,7 @@
<text>{{item.amount}}</text> <text>{{item.amount}}</text>
</view> </view>
<view class="appointment-activity-btn row"> <view class="appointment-activity-btn row">
<button wx:if="{{item.isRefund && item.status !== 7}}" class="delete row cc ac" data-item="{{item}}" catchtap="onOrderRefund">申请退款</button>
<view data-item="{{item}}" catchtap="onOrderUse" class="confirm-btn">去使用</view> <view data-item="{{item}}" catchtap="onOrderUse" class="confirm-btn">去使用</view>
</view> </view>
</view> </view>
...@@ -106,6 +107,7 @@ ...@@ -106,6 +107,7 @@
<text>{{item.amount}}</text> <text>{{item.amount}}</text>
</view> </view>
<view class="appointment-activity-btn row"> <view class="appointment-activity-btn row">
<button wx:if="{{item.isRefund && item.status !== 7}}" class="delete row cc ac" data-item="{{item}}" catchtap="onOrderRefund">申请退款</button>
<view data-item="{{item}}" catchtap="onOrderUse" class="confirm-btn">去使用</view> <view data-item="{{item}}" catchtap="onOrderUse" class="confirm-btn">去使用</view>
</view> </view>
</view> </view>
......
...@@ -248,6 +248,18 @@ ...@@ -248,6 +248,18 @@
right: 172rpx; right: 172rpx;
bottom: 40rpx; bottom: 40rpx;
} }
.delete {
width: 120rpx;
height: 56rpx;
border-radius: 4rpx;
border: 1px solid #c2c7cf;
font-size: 22rpx;
font-weight: 500;
line-height: 32rpx;
color: #656e7b;
}
.confirm-btn { .confirm-btn {
z-index: 4; z-index: 4;
width: 120rpx; width: 120rpx;
......
...@@ -119,6 +119,10 @@ Page({ ...@@ -119,6 +119,10 @@ Page({
this.queryClubAuditTotal() // 查询俱乐部审核数量 this.queryClubAuditTotal() // 查询俱乐部审核数量
}, },
onHide: function () {
wx.removeStorageSync('shopInfoBuffer')
},
/** /**
* 设置用户面板信息 * 设置用户面板信息
* @function * @function
...@@ -228,10 +232,12 @@ Page({ ...@@ -228,10 +232,12 @@ Page({
'cardName': '精灵鸟理想国' + funcData[i].name 'cardName': '精灵鸟理想国' + funcData[i].name
} }
// 设置门店信息 if (i === 0) {
let funcShopInfo = App.setShopInfo(funcItem.shopAppId) // 设置门店信息
funcItem.shopName = funcShopInfo.name let funcShopInfo = App.setShopInfo(funcItem.shopAppId)
funcItem.shopLogo = funcShopInfo.logo funcItem.shopName = funcShopInfo.name
funcItem.shopLogo = funcShopInfo.logo
}
funcList.push(funcItem) funcList.push(funcItem)
} }
......
...@@ -296,6 +296,7 @@ Page({ ...@@ -296,6 +296,7 @@ Page({
'logo': funcItem.shopLogo, 'logo': funcItem.shopLogo,
'shopType': '', 'shopType': '',
} }
console.log('1010')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
wx.navigateTo({ wx.navigateTo({
url: `/pages/pay/order-detail/order-detail?id=${funcItem.id}&shopAppId=${funcItem.shopAppId}`, url: `/pages/pay/order-detail/order-detail?id=${funcItem.id}&shopAppId=${funcItem.shopAppId}`,
...@@ -420,7 +421,7 @@ Page({ ...@@ -420,7 +421,7 @@ Page({
.then((response) => { .then((response) => {
App.ui.showToast({ App.ui.showToast({
'iconType': 'success', 'iconType': 'success',
'title': '退款成功' 'title': '退款申请已提交'
}) })
this.setData({ this.setData({
'isDoing': false, 'isDoing': false,
...@@ -520,30 +521,6 @@ Page({ ...@@ -520,30 +521,6 @@ Page({
url: '/pages/pay/order-comment/order-comment?pageFrom=orderList&id=' + funcId url: '/pages/pay/order-comment/order-comment?pageFrom=orderList&id=' + funcId
}) })
}, },
/**
* 缓存用户信息
* @function
* @param {object} - event
* @returns
*/
setShopInfo: function (funcShopAppId, funcShopType) {
// 获取门店基本信息
let funcShopId = App.globalData.shopId
for (let i = 0, l = funcShopId.length; i < l; i++) {
if (funcShopAppId === funcShopId[i].appId) {
let funcShopInfo = {
'id': funcShopId[i].id,
'appId': funcShopId[i].appId,
'name': funcShopId[i].title[funcShopType],
'logo': funcShopId[i].logo,
'cover': funcShopId[i].cover,
'shopType': funcShopType,
}
wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break
}
}
},
/** /**
* 订单再次下单、去逛逛 * 订单再次下单、去逛逛
......
...@@ -64,6 +64,7 @@ ...@@ -64,6 +64,7 @@
<text class="message" wx:if="{{item.status === 4}}">已过期</text> <text class="message" wx:if="{{item.status === 4}}">已过期</text>
<text class="message" wx:if="{{item.status === 6}}">已评价</text> <text class="message" wx:if="{{item.status === 6}}">已评价</text>
<text class="warning" wx:if="{{item.status === 7}}">退款审核中</text> <text class="warning" wx:if="{{item.status === 7}}">退款审核中</text>
<text class="message" wx:if="{{item.status === 8}}">退款成功</text>
</view> </view>
</view> </view>
...@@ -98,11 +99,11 @@ ...@@ -98,11 +99,11 @@
<view class="row ac"> <view class="row ac">
<button wx:if="{{item.isRefund && item.status !== 7}}" class="delete row cc ac" data-item="{{item}}" catchtap="onOrderRefund">申请退款</button> <button wx:if="{{item.isRefund && item.status !== 7}}" class="delete row cc ac" data-item="{{item}}" catchtap="onOrderRefund">申请退款</button>
<button wx:if="{{item.status === 0}}" class="delete row cc ac" data-index="{{index}}" data-item="{{item}}" catchtap="onOrderCancel" disabled="{{isDoing}}">取消订单</button> <button wx:if="{{item.status === 0}}" class="delete row cc ac" data-index="{{index}}" data-item="{{item}}" catchtap="onOrderCancel" disabled="{{isDoing}}">取消订单</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === -1 || item.status === 4 || item.status === 6}}" class="delete row cc ac" data-item="{{item}}" catchtap="onOrderRemove">删除订单</button> <button disabled="{{isDoing}}" wx:if="{{item.status === -1 || item.status === 4 || item.status === 6 || item.status === 8}}" class="delete row cc ac" data-item="{{item}}" catchtap="onOrderRemove">删除订单</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 0}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderPay">去支付</button> <button disabled="{{isDoing}}" wx:if="{{item.status === 0}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderPay">去支付</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 2}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderUse">去使用</button> <button disabled="{{isDoing}}" wx:if="{{item.status === 2}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderUse">去使用</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === 3}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button> <button disabled="{{isDoing}}" wx:if="{{item.status === 3}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderEvaluate">去评价</button>
<button disabled="{{isDoing}}" wx:if="{{item.status === -1}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button> <button disabled="{{isDoing}}" wx:if="{{item.status === -1 || item.status === 8}}" class="again row cc ac" data-item="{{item}}" catchtap="onOrderAgain">再次下单</button>
</view> </view>
</view> </view>
</view> </view>
...@@ -115,30 +116,4 @@ ...@@ -115,30 +116,4 @@
<button class="row cc ac" wx:if="{{statusActive === 0}}" bindtap="onToBuy">去逛逛</button> <button class="row cc ac" wx:if="{{statusActive === 0}}" bindtap="onToBuy">去逛逛</button>
</view> </view>
</block> </block>
</view>
<!-- 二维码弹窗 -->
<view class="code-mask row cc ac" wx:if="{{winCode}}">
<view class="code column cc ac">
<view class="code-tip column cc ac">
<text>{{'请将券码出示给门店核销人员'}}</text>
<text>{{'请将券码出示给门店核销人员'}}</text>
</view>
<view class="code-info column cc ac">
<view class="code-info-title">
<text>{{'《 阿凡达 》电影票'}}</text>
</view>
<view class="code-info-qrcode">
<image src="{{'data:image/png;base64,' + code.codeBase64}}"></image>
</view>
<view class="code-info-copy row cb ac">
<text>券码</text>
<text>{{'2719 7092 0925'}}</text>
<text>复制</text>
</view>
</view>
<view class="code-close row cc ac" bindtap="onCodeClose">
<image src="{{imageBase + 'icon/close-1.png'}}"></image>
</view>
</view>
</view> </view>
\ No newline at end of file
...@@ -86,22 +86,17 @@ Page({ ...@@ -86,22 +86,17 @@ Page({
}, },
}) })
.then((response) => { .then((response) => {
if (response.data && response.data.code * 1 == 500) { console.log(response)
App.ui.showToast({ App.ui.showToast({
iconType: 'error', iconType: 'success',
title: response.data.message, title: '核销成功',
}) ending: () => {
} else {
App.ui.showToast({
iconType: 'success',
title: '核销成功',
})
setTimeout(() => {
wx.navigateBack() wx.navigateBack()
}, 2000); }
} })
}) })
.catch((response) => { .catch((response) => {
console.log(response)
App.ui.showToast({ App.ui.showToast({
iconType: 'error', iconType: 'error',
title: response.message, title: response.message,
......
...@@ -44,7 +44,7 @@ Page({ ...@@ -44,7 +44,7 @@ Page({
* @param * @param
* @returns * @returns
*/ */
queryOrderDetail: function () {s queryOrderDetail: function () {
App.request({ App.request({
url: 'v1/order/getOrderDetail', url: 'v1/order/getOrderDetail',
params: { params: {
......
...@@ -137,6 +137,38 @@ Page({ ...@@ -137,6 +137,38 @@ Page({
}, 1000) }, 1000)
}, },
onOrderRefund: function () {
App.ui.showDialog({
type: 'confirm',
title: '是否确认申请退款?',
content: '申请后无法撤销',
cancel: '取消',
confirm: '确定',
success: () => {
App.ui.showToast({
'iconType': 'loading',
'title': '处理中',
})
this.setData({
isDoing: true
})
App.request({
url: 'v1/order/orderRefund/' + this.data.orderInfo.id,
method: 'get',
params: {},
})
.then((response) => {
App.ui.showToast({
'iconType': 'success',
'title': '退款申请已提交'
})
this.onReload()
})
},
fail: () => {},
})
},
// 再次下单 // 再次下单
onOrderAgain: function (event) { onOrderAgain: function (event) {
if (this.data.orderInfo.goodsType === -3) { if (this.data.orderInfo.goodsType === -3) {
......
...@@ -46,6 +46,11 @@ ...@@ -46,6 +46,11 @@
<text>退款申请正在审核中,请您耐心等待</text> <text>退款申请正在审核中,请您耐心等待</text>
</view> </view>
</view> </view>
<view class="state-content state-content-invalid column cc" wx:if="{{orderInfo.state === 8}}">
<view class="state-content-title row">
<text>退款成功</text>
</view>
</view>
<view class="state-content state-content-invalid column cc" wx:if="{{orderInfo.state === 9}}"> <view class="state-content state-content-invalid column cc" wx:if="{{orderInfo.state === 9}}">
<view class="state-content-title row"> <view class="state-content-title row">
<text>订单已完成</text> <text>订单已完成</text>
...@@ -291,13 +296,14 @@ ...@@ -291,13 +296,14 @@
</view> </view>
<!-- 底部按钮 --> <!-- 底部按钮 -->
<view class="footer-btn row ce" wx:if="{{orderInfo.state !== 2}}"> <view class="footer-btn row ce" wx:if="{{orderInfo.state !== 7}}">
<!-- 状态(-1已取消,0未付款,1未发货,2待使用,3已使用,4已过期,5已发货,6已关闭/已评价) --> <!-- 状态(-1已取消,0未付款,1未发货,2待使用,3已使用,4已过期,5已发货,6已关闭/已评价) -->
<view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='0' wx:if="{{orderInfo.state === 0}}">取消订单</view> <view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='0' wx:if="{{orderInfo.state === 0}}">取消订单</view>
<view class="order-btn" bindtap="onOrderPay" wx:if="{{orderInfo.state === 0}}">去支付</view> <view class="order-btn" bindtap="onOrderPay" wx:if="{{orderInfo.state === 0}}">去支付</view>
<view class="delete-btn" bindtap="onOrderRefund" wx:if="{{orderInfo.state === 2}}">申请退款</view>
<view class="order-btn" bindtap="onOrderEvaluate" wx:if="{{orderInfo.state === 3}}">去评价</view> <view class="order-btn" bindtap="onOrderEvaluate" wx:if="{{orderInfo.state === 3}}">去评价</view>
<view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='1' wx:if="{{orderInfo.state === 4 || orderInfo.state === -1 || orderInfo.state === 6}}">删除订单</view> <view class="delete-btn" bindtap="onDelOrCancelOrder" data-type='1' wx:if="{{orderInfo.state === 4 || orderInfo.state === -1 || orderInfo.state === 6 || orderInfo.state === 8}}">删除订单</view>
<view class="order-btn" bindtap="onOrderAgain" wx:if="{{orderInfo.state === -1}}">再次下单</view> <view class="order-btn" bindtap="onOrderAgain" wx:if="{{orderInfo.state === -1 || orderInfo.state === 8}}">再次下单</view>
</view> </view>
<!-- 二维码弹窗 --> <!-- 二维码弹窗 -->
......
...@@ -96,6 +96,7 @@ Page({ ...@@ -96,6 +96,7 @@ Page({
}, },
onLoad: function (options) { onLoad: function (options) {
console.log(options)
if (options.type) options.type = Number(options.type) if (options.type) options.type = Number(options.type)
logicData.option = options logicData.option = options
...@@ -953,7 +954,48 @@ Page({ ...@@ -953,7 +954,48 @@ Page({
}, },
}) })
.then((response) => { .then((response) => {
if (/ 商品不存在/.test(response.data.message)) { // 库存充足正常下单支付
let funcResponse = response.data.wxRequest
pagePayId = response.data.orderId
this.setData({
orderId: pagePayId
})
// 支付金额为零,默认支付成功
if (Number(this.data.payAmount) === 0) {
this.payStatus(true)
return
}
wx.requestPayment({
'timeStamp': funcResponse.timeStamp,
'nonceStr': funcResponse.nonceStr,
'package': funcResponse.package,
'signType': funcResponse.signType,
'paySign': funcResponse.paySign,
success: (response) => {
if (response.errMsg === 'requestPayment:ok') {
// 用户点击支付完成按钮回调
// this.payStatus(true)
}
if (response.errMsg === 'requestPayment:fail cancel') {
clearInterval(App.globalData.payStateTimer)
this.payStatus(false)
}
},
fail: (response) => {
clearInterval(App.globalData.payStateTimer)
this.payStatus(false)
}
})
// 开启支付状态轮询
// wx.showLoading({ title: '正在获取数据', mask: true })
this.queryPayStatus(pagePayId)
})
.catch((response) => {
console.log(response)
if (/商品不存在/.test(response.message)) {
wx.setStorageSync('shoppingCartBuffer', []) wx.setStorageSync('shoppingCartBuffer', [])
App.ui.showToast({ App.ui.showToast({
iconType: 'error', iconType: 'error',
...@@ -967,7 +1009,7 @@ Page({ ...@@ -967,7 +1009,7 @@ Page({
return return
} }
if (/价格不一致/.test(response.data.message)) { if (/价格不一致/.test(response.message)) {
wx.setStorageSync('shoppingCartBuffer', []) wx.setStorageSync('shoppingCartBuffer', [])
App.ui.showToast({ App.ui.showToast({
iconType: 'error', iconType: 'error',
...@@ -981,10 +1023,10 @@ Page({ ...@@ -981,10 +1023,10 @@ Page({
return return
} }
if (/订单未支付/.test(response.data.message)) { if (/订单未支付/.test(response.message)) {
App.ui.showToast({ App.ui.showToast({
iconType: 'error', iconType: 'error',
title: response.data.message, title: response.message,
}) })
this.setData({ this.setData({
isPaySubmit: false, isPaySubmit: false,
...@@ -992,12 +1034,12 @@ Page({ ...@@ -992,12 +1034,12 @@ Page({
return return
} }
if (/库存不足/.test(response.data.message)) { if (/库存不足/.test(response.message)) {
let funcList = [] let funcList = []
for (let i = 0, l = response.data.data.list.length; i < l; i++) { for (let i = 0, l = response.data.list.length; i < l; i++) {
let funcItem = { let funcItem = {
'cover': response.data.data.list[i].imgUrl, 'cover': response.data.list[i].imgUrl,
'name': response.data.data.list[i].name 'name': response.data.list[i].name
} }
funcList.push(funcItem) funcList.push(funcItem)
} }
...@@ -1008,47 +1050,6 @@ Page({ ...@@ -1008,47 +1050,6 @@ Page({
}) })
return return
} }
// 库存充足正常下单支付
let funcResponse = response.data.wxRequest
pagePayId = response.data.orderId
this.setData({
orderId: pagePayId
})
// 支付金额为零,默认支付成功
if (Number(this.data.payAmount) === 0) {
this.payStatus(true)
return
}
wx.requestPayment({
'timeStamp': funcResponse.timeStamp,
'nonceStr': funcResponse.nonceStr,
'package': funcResponse.package,
'signType': funcResponse.signType,
'paySign': funcResponse.paySign,
success: (response) => {
if (response.errMsg === 'requestPayment:ok') {
// 用户点击支付完成按钮回调
// this.payStatus(true)
}
if (response.errMsg === 'requestPayment:fail cancel') {
clearInterval(App.globalData.payStateTimer)
this.payStatus(false)
}
},
fail: (response) => {
clearInterval(App.globalData.payStateTimer)
this.payStatus(false)
}
})
// 开启支付状态轮询
// wx.showLoading({ title: '正在获取数据', mask: true })
this.queryPayStatus(pagePayId)
})
.catch((response) => {
this.setData({ this.setData({
isPaySubmit: true, isPaySubmit: true,
}) })
......
...@@ -249,6 +249,7 @@ Page({ ...@@ -249,6 +249,7 @@ Page({
let funcShopInfo = JSON.parse(JSON.stringify(App.globalData.shopId[i])) let funcShopInfo = JSON.parse(JSON.stringify(App.globalData.shopId[i]))
console.log(funcShopInfo.name) console.log(funcShopInfo.name)
if (funcShopType) funcShopInfo.shopType = funcShopType if (funcShopType) funcShopInfo.shopType = funcShopType
console.log('1111')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
} }
} }
......
...@@ -377,6 +377,7 @@ Page({ ...@@ -377,6 +377,7 @@ Page({
'cover': App.globalData.shopId[i].cover, 'cover': App.globalData.shopId[i].cover,
'shopType': this.data.option.type 'shopType': this.data.option.type
} }
console.log('1212')
wx.setStorageSync('shopInfoBuffer', funcItem) wx.setStorageSync('shopInfoBuffer', funcItem)
this.setData({ this.setData({
shopInfo: funcItem shopInfo: funcItem
...@@ -656,6 +657,7 @@ Page({ ...@@ -656,6 +657,7 @@ Page({
'shopType': funcShopType, 'shopType': funcShopType,
'commodityLogo': funcShopId[i].commodityLogo 'commodityLogo': funcShopId[i].commodityLogo
} }
console.log('1313')
wx.setStorageSync('shopInfoBuffer', funcShopInfo) wx.setStorageSync('shopInfoBuffer', funcShopInfo)
break break
} }
......
...@@ -63,7 +63,7 @@ let Output = { ...@@ -63,7 +63,7 @@ let Output = {
response: { response: {
code: funcResponse.data.code, code: funcResponse.data.code,
data: funcResponse.data.list, data: funcResponse.data.list,
message: funcResponse.data.message message: funcResponse.data.msg
} }
} }
} }
...@@ -73,7 +73,7 @@ let Output = { ...@@ -73,7 +73,7 @@ let Output = {
response: { response: {
code: funcResponse.data.code, code: funcResponse.data.code,
data: funcResponse.data.data ? funcResponse.data.data : {}, data: funcResponse.data.data ? funcResponse.data.data : {},
message: funcResponse.data.message message: funcResponse.data.msg
} }
} }
break break
...@@ -83,14 +83,15 @@ let Output = { ...@@ -83,14 +83,15 @@ let Output = {
break break
case 500: case 500:
console.log('request 500', funcResponse)
return { return {
success: false, success: false,
response: { response: {
code: funcResponse.data.code, code: funcResponse.data.code,
data: '', data: funcResponse.data.data ? funcResponse.data.data : '',
message: funcResponse.data.message message: funcResponse.data.msg
}
} }
}
break break
} }
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment