Commit 643a6d9d by TengFengLian

券码核销

parent 0b5a6663
...@@ -61,8 +61,8 @@ App({ ...@@ -61,8 +61,8 @@ App({
// console.log("返回:", res); // console.log("返回:", res);
let code = res.data.code * 1; let code = res.data.code * 1;
if (200 == code) { // if (200 == code) {
// if (200 == code && true == res.data.success) { if (200 == code && true == res.data.success) {
if (obj.success) { if (obj.success) {
obj.success(res.data) obj.success(res.data)
} }
......
const App = getApp()
Page({ Page({
data: { data: {
orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影 orderType: 1, // 1 - 年卡/月卡,2 - 次票, 3 - SPA, 4 - 文创, 5 - 餐品, 6 - 活动, 7 - 观影
couponInfo: { couponInfo: null,
type: '套票', // {
store: '儿童营地', // type: '套票',
id: '26719921231', // store: '儿童营地',
useTime: '2020-11-06' // id: '26719921231',
// useTime: '2020-11-06'
// },
goodsList: null,
// [
// {
// id: 0,
// cover: '',
// name: '咖喱蔬菜大虾',
// quantity: '2',
// price: '30.60'
// },
// {
// id: 1,
// cover: '',
// name: '南瓜坚果汤',
// quantity: '3',
// price: '30.60'
// },
// ],
userList: null,
orderInfo: null,
// {
// name: '林有一',
// phone: '15802035122',
// idNum: '350600366462131',
// },
remarks: null, // 备注
couponDetail: null,
}, },
goodsList: [ onLoad: function (options) {
{ console.log(options)
id: 0, // if (options.type) options.type = Number(options.type)
cover: '', // let orderType = options.type
name: '咖喱蔬菜大虾', // this.setData({
quantity: '2', // orderType
price: '30.60' // })
// this.setView()
if (options.couponDetail) {
let data = JSON.parse(options.couponDetail)
let tmpGoodsList = [];
data.smOrderDetails.forEach(item => {
var tmpItem = {
id: item.commodityId,
cover: item.imgUrl,
name: item.name,
quantity: item.number,
price: item.totalPrices,
}
tmpGoodsList.push(tmpItem)
})
let tmpUserList = [];
data.smPersonalDetails.forEach(item => {
var tmpItem = {
name: item.name,
phone: item.cellPhone,
idNum: item.identityCard,
}
tmpUserList.push(tmpItem)
})
this.setData({
['couponInfo.type']: data.goodType,
['couponInfo.store']: data.officeName,
['couponInfo.id']: data.serialNumber,
['couponInfo.useTime']: data.expireTime,
goodsList: tmpGoodsList,
userList: tmpUserList,
remarks: data.remarks,
couponDetail: data,
})
}
}, },
{
id: 1, // 取消核销
cover: '', cancelOperation() {
name: '南瓜坚果汤', wx.navigateBack()
quantity: '3',
price: '30.60'
}, },
],
orderInfo: { // 确认核销'
name: '林有一', submitOperation() {
phone: '15802035122', let that = this
idNum: '350600366462131', wx.lin.showDialog({
type:"confirm",
title:"",
content:"是否确认核销券码" ,
success: (res) => {
if (res.confirm) {
console.log('用户点击确定')
that.doVolume()
} else if (res.cancel) {
console.log('用户点击取消')
}
} }
})
}, },
onLoad: function (options) {
console.log(options) doVolume() {
if (options.type) options.type = Number(options.type) let that = this
let orderType = options.type wx.lin.showToast({
this.setData({ icon: 'loading',
orderType title: '正在核销',
show: true,
mask: true,
duration: 1000 * 60,
})
App.wxRequest({
url: '/api/v1/volume/doVolume',
data: {
volumeId: that.data.couponDetail.volumeId,
},
success: function(res) {
wx.lin.showToast({
image: '/image/success.png',
title: '核销成功',
}) })
this.setView() setTimeout(()=>{
wx.navigateBack()
},2000);
}, },
setView() { fail: function(err) {
let orderType = this.data.orderType wx.lin.showToast({
switch (orderType) { image: '/image/error.png',
case 4: title: err.msg,
this.setData({ })
goodsList: [
{
cover: '',
name: '《海错图》超级豪华精致古风限量版折扇',
quantity: '1',
price: '30.60'
} }
],
note: '身份证号变更为350600366462132'
}) })
break
case 5:
break
} }
},
}) })
\ No newline at end of file
<navigation class="navigation" titleText="券码核销" background="#ffffff" backIcon="/image/back.png"></navigation> <navigation class="navigation" titleText="券码核销" background="#ffffff" backIcon="/image/back.png"></navigation>
<l-dialog />
<l-toast l-image-class="toast-image"></l-toast>
<view class="container"> <view class="container">
<view class="list-wrapper"> <view class="list-wrapper">
<view class="title-wrapper">兑换券信息</view> <view class="title-wrapper">兑换券信息</view>
...@@ -25,7 +26,7 @@ ...@@ -25,7 +26,7 @@
<view class="goods-list"> <view class="goods-list">
<view class="goods-item row align-c" wx:for="{{goodsList}}" wx:key="id"> <view class="goods-item row align-c" wx:for="{{goodsList}}" wx:key="id">
<view class="goods-img"> <view class="goods-img">
<image mode="widthFix" src="{{item.cover}}"></image> <image mode="aspectFill" src="{{item.cover}}"></image>
</view> </view>
<view class="goods-name">{{item.name}}</view> <view class="goods-name">{{item.name}}</view>
<view class="goods-price-num col"> <view class="goods-price-num col">
...@@ -38,47 +39,32 @@ ...@@ -38,47 +39,32 @@
</view> </view>
</view> </view>
</view> </view>
<view class="list-wrapper"> <view class="list-wrapper" wx:for="{{userList}}" wx:key="index">
<view class="title-wrapper">订单详情</view> <view class="title-wrapper">订单详情</view>
<view class="info-wrapper row con-b"> <view class="info-wrapper row con-b">
<view class="info-name">姓名</view> <view class="info-name">姓名</view>
<view class="info-text">{{orderInfo.name}}</view> <view class="info-text">{{item.name}}</view>
</view> </view>
<view class="info-wrapper row con-b"> <view class="info-wrapper row con-b" wx:if="{{item.phone}}">
<view class="info-name">手机</view> <view class="info-name">手机</view>
<view class="info-text">{{orderInfo.phone}}</view> <view class="info-text">{{item.phone}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-name">身份证</view>
<view class="info-text">{{orderInfo.idNum}}</view>
</view>
</view> </view>
<view class="list-wrapper"> <view class="info-wrapper row con-b" wx:if="{{item.idNum}}">
<view class="title-wrapper">订单详情</view>
<view class="info-wrapper row con-b">
<view class="info-name">姓名</view>
<view class="info-text">{{orderInfo.name}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-name">手机</view>
<view class="info-text">{{orderInfo.phone}}</view>
</view>
<view class="info-wrapper row con-b">
<view class="info-name">身份证</view> <view class="info-name">身份证</view>
<view class="info-text">{{orderInfo.idNum}}</view> <view class="info-text">{{item.idNum}}</view>
</view> </view>
</view> </view>
<view class="list-wrapper" wx:if="{{note}}"> <view class="list-wrapper" wx:if="{{remarks}}">
<view class="title-wrapper">备注</view> <view class="title-wrapper">备注</view>
<view class="info-wrapper row con-b"> <view class="info-wrapper row con-b">
<view class="info-name">{{note}}</view> <view class="info-name">{{remarks}}</view>
</view> </view>
</view> </view>
</view> </view>
<view class="footer-wrapper"> <view class="footer-wrapper">
<view class="footer-btn row con-b align-e"> <view class="footer-btn row con-b align-e">
<view class="cancel-btn">取消核销</view> <view class="cancel-btn" bindtap="cancelOperation">取消核销</view>
<view class="confirm-btn">确认核销</view> <view class="confirm-btn" bindtap="submitOperation">确认核销</view>
</view> </view>
<Blank></Blank> <Blank></Blank>
</view> </view>
.container { .container {
margin-top: 130rpx; margin-top: 150rpx;
padding-bottom: 196rpx; padding-bottom: 196rpx;
} }
.list-wrapper { .list-wrapper {
......
...@@ -43,7 +43,7 @@ Page({ ...@@ -43,7 +43,7 @@ Page({
let that = this let that = this
wx.lin.showToast({ wx.lin.showToast({
icon: 'loading', icon: 'loading',
title: '加载中', title: '正在识别',
show: true, show: true,
mask: true, mask: true,
duration: 1000 * 60, duration: 1000 * 60,
......
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