Commit 85d4be07 by 张立顺

Merge branch 'SAAS+V5.6.0' into SAAS+V5.6.1

2 parents 822785d7 b8b854f9
......@@ -231,7 +231,8 @@ Component({
if (s.goods.goodsId == e.goods.goodsId) {
e.active = true
e.count = s.count
e.goods.sellPrice = s.goods.sellPrice
// e.goods.sellPrice = s.goods.sellPrice
Object.assign(e.goods, s.goods)
}
}
//初始化进来不显示标识
......@@ -246,6 +247,15 @@ Component({
e.multipleSpecificationsGoods.id
) {
e.count = s.count
if (
s.multipleSpecificationsGoods.goods &&
e.multipleSpecificationsGoods.goods
) {
Object.assign(
e.multipleSpecificationsGoods.goods,
s.multipleSpecificationsGoods.goods
)
}
// e.active=s.acitve
}
}
......@@ -283,17 +293,27 @@ Component({
console.log(arr, 'removeDuplicates')
var uniqueArray = []
for (var i = 0; i < arr.length; i++) {
let goodsType =
arr[i].goodsFlag == 1 ? 'goods' : 'multipleSpecificationsGoods.goods'
let goodsType = ''
if (arr[i].goodsFlag == 1) {
goodsType = 'goods'
} else if (arr[i].goodsFlag == 2) {
goodsType = 'multipleSpecificationsGoods.goods'
} else if (arr[i].goodsFlag == 3) {
goodsType = 'packageGoods'
}
let value = this.circulation(arr[i], goodsType)[property]
// 兼容套餐
let result = uniqueArray.some(item => {
let key =
item.goodsFlag == 1
? 'goods'
: item.goodsFlag == 2
? 'multipleSpecificationsGoods.goods'
: ''
let key = ''
if (item.goodsFlag == 1) {
key = 'goods'
} else if (item.goodsFlag == 2) {
key = 'multipleSpecificationsGoods.goods'
} else if (item.goodsFlag == 3) {
key = 'packageGoods'
}
let deepValue = this.circulation(item, key)
return deepValue ? deepValue[property] === value : false
})
......@@ -354,7 +374,7 @@ Component({
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goods && x.goods.goodsId == c.goods.goodsId) {
c.goods.price = x.goods.price || 0
Object.assign(c.goods, x.goods)
}
})
}
......@@ -373,14 +393,27 @@ Component({
x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId
) {
c.multipleSpecificationsGoods.goods.price =
x.multipleSpecificationsGoods.goods.price || 0
Object.assign(
c.multipleSpecificationsGoods.goods,
x.multipleSpecificationsGoods.goods
)
}
}
})
}
}
}
if (c.packageGoods) {
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 3 && x.packageGoods) {
if (x.packageGoods.goodsId == c.packageGoods.goodsId) {
Object.assign(c.packageGoods, x.packageGoods)
}
}
})
}
}
}
})
return arr
......
......@@ -6,42 +6,39 @@ Component({
properties: {
//1:精品升级 0 会员权益
sceneType: {
type: String,
type: String
},
show: {
type: Boolean,
observer: function (n) { }
observer: function (n) {}
},
goodsData: {
type: Object,
observer: function (n) {
console.log(n, '999', this.data.chooseGoodsList)
this.setGoodsActive();
this.setGoodsActive()
}
},
chooseGoodsList: {
type: Array,
observer: function (n) {
// this.setGoodsActive();
},
},
}
}
},
observers: {
'show': function (value, old) {
console.log(value, old, 'show');
show: function (value, old) {
console.log(value, old, 'show')
let thisPage = wx.$router.getPageInstance()
thisPage.setData({
scrollDisabled: value
})
}
},
/**
* 组件的初始数据
*/
data: {
},
data: {},
/**
* 组件的方法列表
......@@ -49,25 +46,30 @@ Component({
methods: {
setGoodsActive() {
//同步数量
let {
chooseGoodsList,
goodsData
} = this.data;
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(c => {
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 2) {
if (x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.goodsId) {
c.count = x.count || 0
let { chooseGoodsList, goodsData } = this.data
if (
goodsData &&
goodsData.multipleSpecificationsGoods &&
goodsData.multipleSpecificationsGoods.skuGoodsList
) {
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(c => {
if (chooseGoodsList && chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 2) {
if (
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId == c.goodsId
) {
c.count = x.count || 0
}
}
}
})
}
})
this.setData({
goodsData
})
})
}
})
this.setData({
goodsData
})
}
},
hidePopup() {
this.setData({
......@@ -76,34 +78,23 @@ Component({
this.triggerEvent('cancel')
},
choose(e) {
let {
item,
index
} = e.currentTarget.dataset
let {
goodsData
} = this.data
let {
active
} = item
let { item, index } = e.currentTarget.dataset
let { goodsData } = this.data
let { active } = item
//全部取消选择
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(item => item.active = false)
goodsData.multipleSpecificationsGoods.skuGoodsList.forEach(
item => (item.active = false)
)
goodsData.multipleSpecificationsGoods.skuGoodsList[index].active = !active
this.setData({
goodsData
})
},
input(e) {
let {
index
} = e.currentTarget.dataset
let {
goodsData
} = this.data
let { index } = e.currentTarget.dataset
let { goodsData } = this.data
console.log(e)
let {
value
} = e.detail
let { value } = e.detail
if (value < 1) value = 1
if (value > 999) value = 999
goodsData.multipleSpecificationsGoods.skuGoodsList[index].count = value
......@@ -117,10 +108,7 @@ Component({
})
},
getChooseList() {
let {
chooseGoodsList,
goodsData
} = this.data;
let { chooseGoodsList, goodsData } = this.data
console.log(chooseGoodsList, goodsData)
let chooseList = [],
selectList = []
......@@ -134,10 +122,13 @@ Component({
goodsFlag: 2,
isFlag: true,
multipleSpecificationsGoods: {
baseGoodsName: goodsData.multipleSpecificationsGoods.baseGoodsName,
baseGoodsName:
goodsData.multipleSpecificationsGoods.baseGoodsName,
id: goodsData.multipleSpecificationsGoods.id,
specificationGoodsMap: goodsData.multipleSpecificationsGoods.specificationGoodsMap,
specificationList: goodsData.multipleSpecificationsGoods.specificationList,
specificationGoodsMap:
goodsData.multipleSpecificationsGoods.specificationGoodsMap,
specificationList:
goodsData.multipleSpecificationsGoods.specificationList,
goods: c
}
})
......@@ -148,43 +139,57 @@ Component({
if (selectList.length) {
selectList.forEach(c => {
if (!c.count) c.count = 1
c.multipleSpecificationsGoods.goods.price = c.multipleSpecificationsGoods.goods.sellPrice || 0
c.multipleSpecificationsGoods.goods.price =
c.multipleSpecificationsGoods.goods.sellPrice || 0
if (chooseGoodsList.length > 0) {
chooseGoodsList.map(x => {
if (x.goodsFlag == 2 && x.multipleSpecificationsGoods) {
console.log(x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId, 'x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId')
if (x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId) {
console.log(
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId,
'x.multipleSpecificationsGoods.goods && x.multipleSpecificationsGoods.goods.goodsId == c.multipleSpecificationsGoods.goods.goodsId'
)
if (
x.multipleSpecificationsGoods.goods &&
x.multipleSpecificationsGoods.goods.goodsId ==
c.multipleSpecificationsGoods.goods.goodsId
) {
console.log(c)
//精品升级需要处理数量,会员权益不需要
x.count = c.multipleSpecificationsGoods.goods.count || 0
}
}
})
let arr = chooseGoodsList.filter(item => item.multipleSpecificationsGoods && item.multipleSpecificationsGoods.goods)
let arr = chooseGoodsList.filter(
item =>
item.multipleSpecificationsGoods &&
item.multipleSpecificationsGoods.goods
)
console.log(arr)
selectList.forEach(oldval => {
if (oldval.multipleSpecificationsGoods) {
if (!arr.some(newVal => newVal.multipleSpecificationsGoods.goods.goodsId == oldval.multipleSpecificationsGoods.goods.goodsId)) {
if (
!arr.some(
newVal =>
newVal.multipleSpecificationsGoods.goods.goodsId ==
oldval.multipleSpecificationsGoods.goods.goodsId
)
) {
chooseList.push(oldval)
}
}
})
} else {
chooseList = selectList
}
})
}
console.log(chooseList, 'chooseList')
chooseList = chooseList.concat(chooseGoodsList)
console.log(chooseList, 'chooseList')
return [selectList, chooseList]
},
confirm() {
let [selectList, chooseList] = this.getChooseList()
......@@ -194,22 +199,25 @@ Component({
let thisPage = wx.$router.getPageInstance()
if (this.data.sceneType == 1) {
thisPage.setData({
goodsList: chooseList,
});
thisPage?.setGoodsTotal && thisPage.setGoodsTotal(chooseList);
} else {
thisPage.setData({
['orderInfo.vdQuotationGoodsList']: chooseList
}, () => {
//会员权益
thisPage.totalFee()
goodsList: chooseList
})
thisPage?.setGoodsTotal && thisPage.setGoodsTotal(chooseList)
} else {
thisPage.setData(
{
['orderInfo.vdQuotationGoodsList']: chooseList
},
() => {
//会员权益
thisPage.totalFee()
}
)
}
this.setData({
show: false
})
},
}
},
lifetimes: {
attached() {
......@@ -219,5 +227,4 @@ Component({
})
}
}
})
\ No newline at end of file
})
......@@ -574,12 +574,36 @@ Component({
if (!chooseList.length) return wx.$util.showToast('请勾选商品')
this.triggerEvent('confirm', chooseList)
let thisPage = wx.$router.getPageInstance()
// let total = 0
// chooseList.map(i => (total += i.count * i.price))
let oldList = thisPage.data.orderInfo.vdQuotationGoodsList || []
let mergedList = chooseList.map(newItem => {
let oldItem = oldList.find(oldItem => {
if (newItem.goods && oldItem.goods) {
return newItem.goods.goodsId == oldItem.goods.goodsId
}
if (newItem.packageGoods && oldItem.packageGoods) {
return newItem.packageGoods.packageCode == oldItem.packageGoods.packageCode
}
if (newItem.multipleSpecificationsGoods && oldItem.multipleSpecificationsGoods) {
if (newItem.multipleSpecificationsGoods.goods && oldItem.multipleSpecificationsGoods.goods) {
return newItem.multipleSpecificationsGoods.goods.goodsId == oldItem.multipleSpecificationsGoods.goods.goodsId
}
}
return false
})
if (oldItem) {
let count = newItem.count || 1
return {
...oldItem,
count: count
}
}
return newItem
})
thisPage.setData({
['orderInfo.vdQuotationGoodsList']: chooseList,
// ['orderInfo.total']: wx.$util.decimal(total, 2)
['orderInfo.vdQuotationGoodsList']: mergedList,
}, () => {
// console.log(thisPage);
thisPage.totalFee()
......
......@@ -9,6 +9,7 @@
"popup-input": "../PopupInput/PopupInput",
"goods": "../GoodsPackage/Goods",
"sku-goods": "/components/SkuGoods/Goods",
"date-select":"/components/DateSelect/dateSelect"
"date-select":"/components/DateSelect/dateSelect",
"van-picker": "@vant/weapp/picker/index"
}
}
\ No newline at end of file
......@@ -265,63 +265,129 @@
}
.goods-box .goods {
min-height: var(--fontSize118);
border-bottom: var(--fontSize2) solid rgba(195, 195, 195, .3);
// background: #F7F8FA;
background: #f7f8fa;
border-radius: var(--fontSize16);
margin: var(--fontSize16) var(--fontSize0);
display: flex;
align-items: center;
padding: 20rpx var(--fontSize28) 20rpx var(--fontSize90);
// flex-direction: column;
padding: var(--fontSize24);
justify-content: space-between;
font-size: var(--fontSize28);
background: #F5F5F7;
position: relative;
color: #222222;
/* align-items: center; */
}
.goods-box .goods {
.goods-box .goods+.goods {
margin-top: 16rpx;
}
.goods-box .goods .icon {
width: var(--fontSize40);
height: var(--fontSize40);
display: flex;
align-items: center;
justify-content: space-between;
min-height: var(--fontSize118);
border-bottom: var(--fontSize2) solid rgba(195, 195, 195, .3);
padding: 20rpx var(--fontSize28) 20rpx var(--fontSize90);
font-size: var(--fontSize28);
background: #F5F5F7;
position: relative;
color: #222222;
justify-content: center;
margin-right: var(--fontSize20);
flex-shrink: 0;
}
.goods .package {
background: #fff;
.goods-box .goods .icon image {
width: 100%;
height: 100%;
}
.goods.total-box {
background: #fff;
}
.goods-box .goods .goods-content {
flex: 1;
display: flex;
flex-direction: column;
overflow: hidden;
.goods .icon {
position: absolute;
top: 50%;
left: var(--fontSize40);
width: var(--fontSize40);
height: var(--fontSize40);
transform: translateY(-50%);
.alias {
font-size: 12px;
color: #222222 !important;
margin-bottom: 8rpx;
}
}
.goods-box .goods .name {
color: #FF6601;
max-width: var(--fontSize450);
width: 100%;
// margin-bottom: var(--fontSize8);
word-break: break-all;
}
.goods-box .goods .bottom_box {
display: flex;
align-items: center;
justify-content: space-between;
}
.goods-box .goods .bottom_box .left {
display: flex;
flex-direction: column;
flex: 1;
margin-right: var(--fontSize20);
}
.goods-box .goods .bottom_box .right {
display: flex;
align-items: center;
justify-content: flex-start;
}
.goods-box .goods .package {
display: flex;
align-items: center;
justify-content: space-between;
width: 100%;
}
.goods-box .goods .package .name {
width: auto;
margin-bottom: 0;
flex: 1;
padding-right: var(--fontSize20);
}
.goods-box .goods .package .package-price {
font-weight: 600;
color: #333333;
}
.goods-box .goods .packageBox {
width: 100%;
margin-top: var(--fontSize20);
}
.goods-box .goods .packageBox .itemSty {
margin-bottom: var(--fontSize24);
padding-bottom: var(--fontSize24);
border-bottom: 1px dashed #eeeeee;
}
.goods-box .goods .packageBox .itemSty:last-child {
margin-bottom: 0;
padding-bottom: 0;
border-bottom: none;
}
.goods-box .goods .price-box {
width: var(--fontSize240);
// width: var(--fontSize240);
height: var(--fontSize64);
background: #FFFFFF;
border: var(--fontSize2) solid #E6E6E6;
border-radius: var(--fontSize8);
position: relative;
margin-right: var(--fontSize32);
margin-left: auto;
min-width: 160rpx;
max-width: 160rpx;
}
.serveName {
width: 100%;
white-space: pre-wrap;
word-wrap: break-word;
overflow-wrap: break-word;
}
.price-box-Modify {
......@@ -331,8 +397,8 @@
font-weight: 400;
font-size: 28rpx;
color: #333333;
width: var(--fontSize240);
min-width: 160rpx;
// width: var(--fontSize240);
min-width: 140rpx;
height: var(--fontSize64);
margin-right: var(--fontSize32);
}
......@@ -347,12 +413,13 @@
.goods-box .goods .price input {
box-sizing: border-box;
width: 100%;
width: 160rpx;
height: var(--fontSize64);
min-height: 100%;
font-size: var(--fontSize28);
padding: 0 var(--fontSize16) 0 var(--fontSize50);
color: #333333;
text-align: end;
}
.goods-box .goods .price input.error {
......@@ -366,11 +433,17 @@
}
.goods-box .total-box {
padding: 0 var(--fontSize40);
color: #222222;
font-size: 28rpx;
background-color: #fff;
// padding: 0 var(--fontSize40);
}
.goods-box .goods .total {
color: #F24724;
// color: #F24724;
color: #eb4e4e;
font-size: 28rpx;
font-weight: 600;
}
.switch-box {
......@@ -436,6 +509,117 @@
}
}
/* Strategy Box Styles */
.strategy-box {
margin-top: 10rpx;
padding-top: 10rpx;
border-top: 1rpx solid #eee;
.discount-types {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
.discount-tabs {
display: flex;
align-items: center;
background: #e9e9e9;
padding: 6rpx;
border-radius: 8rpx;
.type-item {
padding: 10rpx 12rpx;
background: transparent;
border-radius: 6rpx;
margin-right: 0;
font-size: 24rpx;
color: #222;
border: none;
&.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
}
}
.discount-input {
box-sizing: border-box;
width: 160rpx;
display: flex;
align-items: center;
margin-left: 10rpx;
background: #fff;
padding: 0 10rpx;
height: 64rpx;
border-radius: 8rpx;
border: 2rpx solid #eff0f2;
input {
width: 160rpx;
border-radius: 0;
padding: 0;
font-size: 24rpx;
height: 100%;
margin-right: 6rpx;
background: transparent;
color: #333333;
// text-align: left;
text-align: end;
}
text {
font-size: 24rpx;
color: #333;
line-height: 0rpx;
}
}
}
.gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
font-size: 28rpx;
color: #222222;
.gift-radios {
display: flex;
align-items: center;
.radio-label {
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
radio {
transform: scale(0.6);
}
}
}
}
.final-price {
font-size: 28rpx;
color: #222222;
display: flex;
align-items: center;
justify-content: space-between;
.orange {
color: #FF6601;
font-weight: bold;
font-size: 30rpx;
margin-left: 10rpx;
}
}
}
.van-cell:after {
border: none !important;
}
......@@ -452,16 +636,6 @@
position: relative;
}
.deleteicon {
// position: absolute;
// top: 50%;
// left: 40rpx;
// transform: translateY(-50%);
width: var(--fontSize40);
height: var(--fontSize40);
margin-right: 10rpx;
}
.goods-box .packageList {
height: auto;
display: flex;
......@@ -473,7 +647,8 @@
display: flex;
align-items: center;
min-height: 104rpx;
padding: 20rpx 0;
padding: 20rpx var(--fontSize24);
box-sizing: border-box;
.package-price {
margin-left: auto;
......@@ -484,7 +659,6 @@
.packageBox {
box-sizing: border-box;
width: 630rpx;
// height: 104rpx;
background: #F5F5F7;
.itemSty {
......@@ -508,7 +682,7 @@
.payType-box {
display: flex;
align-items: center;
// flex-wrap: wrap;
/* flex-wrap: wrap; */
padding-top: var(--fontSize20);
justify-content: flex-end;
margin-right: calc(-1 * var(--fontSize40));
......@@ -593,6 +767,101 @@
justify-content: space-between;
}
.payment-text{
color: #666666;
.discount-box {
margin-top: var(--fontSize16);
padding-top: var(--fontSize16);
border-top: 1rpx solid #eee;
.discount-type {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--fontSize16);
.type-tabs {
display: flex;
align-items: center;
background: #F0F1F5;
padding: var(--fontSize6);
border-radius: var(--fontSize8);
.type-item {
padding: var(--fontSize10) var(--fontSize12);
background: transparent;
border-radius: var(--fontSize6);
font-size: var(--fontSize24);
color: #222;
transition: all 0.3s;
&.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
}
}
.discount-input {
display: flex;
align-items: center;
margin-left: var(--fontSize10);
background: #fff;
padding: 0 var(--fontSize10);
height: var(--fontSize64);
border-radius: var(--fontSize8);
border: 2rpx solid #eff0f2;
input {
width: 140rpx;
font-size: var(--fontSize24);
height: 100%;
text-align: left;
}
text {
font-size: var(--fontSize24);
color: #333;
}
}
}
.final-price {
font-size: var(--fontSize28);
color: #222222;
display: flex;
align-items: center;
justify-content: space-between;
.price-val {
color: #FF6601;
font-weight: bold;
font-size: var(--fontSize30);
}
}
}
.gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: var(--fontSize16);
font-size: var(--fontSize28);
color: #222222;
.gift-radios {
display: flex;
align-items: center;
.radio-label {
margin-left: var(--fontSize20);
display: flex;
align-items: center;
font-size: var(--fontSize24);
radio {
transform: scale(0.6);
}
}
}
}
\ No newline at end of file
......@@ -2,44 +2,86 @@
<glsx-privacy appletName="生意助手员工版" bind:agreeClick="agreeClick" bind:disagreeClick="disagreeClick"></glsx-privacy>
<!-- <scroll-view class="container" scroll-y style="height:{{windowHeight}}px"> -->
<navigation-bar class="navigation-header" bindnavbarReady="navbarReady" showBack="{{ true }}" bindback="back">
<view class="navigation-title">
<view class="navigation-title-text text-hide">
车险信息
</view>
</view>
<view class="navigation-title">
<view class="navigation-title-text text-hide">车险信息</view>
</view>
</navigation-bar>
<!-- {{scrollDisabled? "": height:{{windowHeight}}px}} -->
<view class="layout {{(showTips||waitInputCount)?'fullSucreen-tips':'' }} {{scrollDisabled?'scroll-disabled':''}}" style="padding-top:{{ navBarHeight }}px; ">
<first-step id="FirstStep" serviceInfo="{{ owner }}" dataAttrName="{{ dataAttrName }}" orderInfo="{{ orderInfo }}" subBtnShow="{{ false }}" mode="{{mode}}" />
<second-step id="SecondStep" orderInfo="{{ orderInfo }}" quotationGoodsList="{{ quotationGoodsList }}" bindconfirm="handleSecondConfirm" bindeditSave="handleEditSave" paymentMethod="{{paymentMethod}}" />
<view
class="layout {{ (showTips||waitInputCount)?'fullSucreen-tips':'' }} {{scrollDisabled?'scroll-disabled':'' }}"
style="padding-top:{{ navBarHeight }}px;"
>
<first-step
id="FirstStep"
serviceInfo="{{ owner }}"
dataAttrName="{{ dataAttrName }}"
orderInfo="{{ orderInfo }}"
subBtnShow="{{ false }}"
mode="{{ mode }}"
/>
<second-step
id="SecondStep"
orderInfo="{{ orderInfo }}"
quotationGoodsList="{{ quotationGoodsList }}"
bindconfirm="handleSecondConfirm"
bindeditSave="handleEditSave"
paymentMethod="{{ paymentMethod }}"
totalFee="{{ totalFee }}"
bind:showTips="tipsEvent"
/>
</view>
<view wx:if="{{showTips}}" class="btns {{isFullSucreen?'isFullSucreen-btn':''}}">
<view class="tips">
<image class=" tipsIcon" src="../../../images/tips.png" />
<view class="contentText">
<view class="tradeNoCon">
<view>交易参考号:</view>
<view class="tradeNo text-hide">{{tradeNo}}</view>
<view>(共{{selectOutTradeNoArr.length}}条)</view>
</view>
<!-- <view>支付时间:{{accountDate}}</view> -->
<view class="tipsbox">
<view>支付金额:¥{{totalFee/100}}</view>
<view class="tipsbtn" bindtap="tipsEvent">补录订单</view>
</view>
</view>
<!-- <image class="closeIcon" bindtap="closeTips" src="../../../images/closeIcon.png" /> -->
</view>
<view wx:if="{{ showTips && !orderInfo.resetOrder }}" class="btns {{ isFullSucreen?'isFullSucreen-btn':'' }}">
<view class="tips">
<image class="tipsIcon" src="../../../images/tips.png" />
<view class="contentText">
<view class="tradeNoCon">
<view>交易参考号:</view>
<view class="tradeNo text-hide">{{tradeNo}}</view>
<view>(共{{selectOutTradeNoArr.length}}条)</view>
</view>
<!-- <view>支付时间:{{accountDate}}</view> -->
<view class="tipsbox">
<view>支付金额:¥{{totalFee/100}}</view>
<view class="tipsbtn" bindtap="tipsEvent">补录订单</view>
</view>
</view>
<!-- <image class="closeIcon" bindtap="closeTips" src="../../../images/closeIcon.png" /> -->
</view>
</view>
<!-- </scroll-view> -->
<!-- 2025-8月版本 隐藏补录订单入口 -->
<!-- <view class="waitOrderCon {{ showTips? 'showTips':'' }}" wx:if="{{ waitInputCount && !orderInfo.resetOrder && !isErrorOrder&&!outTradeNo }}">
<tips-bottom style="width: 100%;box-sizing: border-box;" tipsProps="{{ tipsProps }}" />
</view> -->
<order-no-popup wx:if="{{ showOrderpop && !(isErrorOrder) }}" outTradeNo="{{ selectOutTradeNoArr }}" switchValuerec="{{switchValue}}" show="{{ showOrderpop }}" bind:success="navigator" title="请选择交易参考号" />
<order-popup orderType="{{orderInfo.payType }}" resetTransNo="{{orderInfo.transactionNo || orderInfo.outTradeNo}}" resetOrder="{{orderInfo.resetOrder}}" orderInfo="{{orderInfo}}" wx:if="{{showPopup}}" show="{{showPopup}}" />
<order-no-popup
wx:if="{{ showOrderpop }}"
outTradeNo="{{ selectOutTradeNoArr }}"
switchValuerec="{{ switchValue }}"
show="{{ showOrderpop }}"
bind:success="navigator"
title="请选择交易参考号"
/>
<order-popup
orderType="{{ orderInfo.payType }}"
resetTransNo="{{ orderInfo.transactionNo || orderInfo.outTradeNo }}"
resetOrder="{{ orderInfo.resetOrder }}"
orderInfo="{{ orderInfo }}"
wx:if="{{ showPopup }}"
show="{{ showPopup }}"
/>
<!-- vin二次复核 -->
<vin-sec-dialog wx:if="{{showVinDialog}}" showVinDialog="{{showVinDialog}}" secFormData="{{secFormData}}" bindonClose="handleSecClose" bindonConfirm="handleSecConfirm"></vin-sec-dialog>
<vin-sec-dialog
wx:if="{{ showVinDialog }}"
showVinDialog="{{ showVinDialog }}"
secFormData="{{ secFormData }}"
bindonClose="handleSecClose"
bindonConfirm="handleSecConfirm"
></vin-sec-dialog>
<!-- 上传合同协议 -->
<zy-pay-popup show="{{showZyPopup}}" wx:if="{{showZyPopup}}" supplementaryFlag="{{supplementaryFlag}}" bindconfirm="zyPayConfirm"></zy-pay-popup>
<zy-pay-popup
show="{{ showZyPopup }}"
wx:if="{{ showZyPopup }}"
supplementaryFlag="{{ supplementaryFlag }}"
bindconfirm="zyPayConfirm"
></zy-pay-popup>
<study-permission-modal id="customModal" />
\ No newline at end of file
......@@ -314,7 +314,7 @@ Page({
})
getRecruitDetailAPI({
id: id
id: '341'
})
.then(res => {
let {
......@@ -386,7 +386,7 @@ Page({
recruitmentInfoConfig: filteredRecruitmentInfoConfig
})
})
.catch(err => {})
.catch(err => { })
},
/**
* 处理按钮点击
......@@ -666,35 +666,35 @@ Page({
/**
* 生命周期函数--监听页面初次渲染完成
*/
onReady() {},
onReady() { },
/**
* 生命周期函数--监听页面显示
*/
onShow() {},
onShow() { },
/**
* 生命周期函数--监听页面隐藏
*/
onHide() {},
onHide() { },
/**
* 生命周期函数--监听页面卸载
*/
onUnload() {},
onUnload() { },
/**
* 页面相关事件处理函数--监听用户下拉动作
*/
onPullDownRefresh() {},
onPullDownRefresh() { },
/**
* 页面上拉触底事件的处理函数
*/
onReachBottom() {},
onReachBottom() { },
/**
* 用户点击右上角分享
*/
onShareAppMessage() {}
onShareAppMessage() { }
})
......@@ -51,12 +51,14 @@ Page({
})
// 没有返回触发事件, 使用定时器轮询学习状态,是否卸载返回拦截弹窗
this.setTime(param)
}
}
},
setTime(param) {
time = setTimeout(() => {
commonApi.getShortCourseDetail({
commonApi
.getShortCourseDetail({
id: param?.studyId
})
.then(res => {
......@@ -105,11 +107,11 @@ Page({
},
handleMessage(e) {
const { data } = e.detail;
const { data } = e.detail
// 将数据返回给跳转来源
if (data) {
const eventChannel = this.getOpenerEventChannel();
eventChannel.emit('webViewMessage', data[0]); // 发送数据
const eventChannel = this.getOpenerEventChannel()
eventChannel.emit('webViewMessage', data[0]) // 发送数据
this.setData({
isH5Bind: true
})
......@@ -128,9 +130,9 @@ Page({
}
// 中邮上传合同协议页面
if (url.includes('zyUpload')) {
const eventChannel = this.getOpenerEventChannel();
const eventChannel = this.getOpenerEventChannel()
if (!this.data.isH5Bind) {
eventChannel.emit('webViewMessage', 'cancel'); // 发送数据
eventChannel.emit('webViewMessage', 'cancel') // 发送数据
}
}
// 北森考试页面返回
......
Component({
options: {
addGlobalClass: true
},
properties: {
product: {
type: Object,
value: {}
},
orderType: {
type: Number,
value: 1
},
selectPayType: {
type: Number,
value: 0
},
index: {
type: Number,
value: 0
},
gindex: {
type: Number,
value: -1
},
count: {
type: Number,
value: 1
},
isPackageSubItem: {
type: Boolean,
value: false
},
positionTypeList: {
type: Array,
value: []
},
baseConfigData: {
type: Object,
value: {}
},
positionNum: {
type: String,
value: ''
},
popupType: {
type: String,
value: '2'
},
showPopupName: {
type: String,
value: 'goodsBox'
},
productName: {
type: String,
value: ''
}
},
methods: {
changePrice(e) {
this.triggerEvent('priceChange', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex,
item: this.data.product
})
},
priceBlur(e) {
this.triggerEvent('priceBlur', {
index: this.data.index,
gindex: this.data.gindex
})
},
changeProductDiscountType(e) {
const { type } = e.currentTarget.dataset
this.triggerEvent('discountTypeChange', {
type,
index: this.data.index,
gindex: this.data.gindex
})
},
inputDiscountValue(e) {
this.triggerEvent('discountValueInput', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex
})
},
toggleGift(e) {
this.triggerEvent('toggleGift', {
value: e.detail.value,
index: this.data.index
})
},
delGoodsList() {
this.triggerEvent('delete', {
index: this.data.index
})
},
showPopup(e) {
const dataset = e.currentTarget.dataset
// Pass the dataset needed for popup
this.triggerEvent('showPopup', {
...dataset,
index: this.data.index,
gindex: this.data.gindex
})
},
// For package sub-items, sometimes we need to know if it's the package itself or item inside
changeMealPrice(e) {
this.triggerEvent('mealPriceChange', {
value: e.detail.value,
index: this.data.index,
gindex: this.data.gindex,
item: this.data.product
})
}
}
})
{
"component": true,
"usingComponents": {}
}
\ No newline at end of file
<wxs src="/tabWorkOrder/index.wxs" module="filter" />
<view class="goods">
<view class="name_box">
<view class="name text-hide alias" wx:if="{{ product.goodsAlias && productName }}">商品别名: {{product.goodsAlias}}</view>
<view class="name text-hide">
{{productName || filter.replaceItemText(product.goodsAlias) || filter.replaceItemText(product.upgradeGoodsName) || filter.replaceItemText(product.goodsInfo.goodsName)}}
</view>
</view>
<view class="bottom_box">
<view class="position" wx:if="{{ product.specificationStr }}">{{product.specificationStr}}</view>
<view
class="position"
wx:elif="{{ (product.merchantGoodsPosition || product.upgradeGoodsPosition || product.goodsInfo.goodsTypeName) }}"
>
<!-- Logic for formatting position -->
<block
wx:if="{{ product.goodsInfo.goodsType == 1 || product.upgradeGoodsType == 1 || product.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || product.upgradeGoodsType == baseConfigData.selfBuildFilmType }}"
>{{filter.formatPosition((product.merchantGoodsPosition || product.upgradeGoodsPosition), positionTypeList)}}</block>
<block wx:else>{{product.goodsInfo.goodsTypeName || ''}}</block>
</view>
<view
class="position red_text"
wx:elif="{{ (product.goodsInfo.goodsType == 1 || product.upgradeGoodsType == 1 || product.goodsInfo.goodsType == baseConfigData.selfBuildFilmType || product.upgradeGoodsType == baseConfigData.selfBuildFilmType) && !product.merchantGoodsPosition && !product.upgradeGoodsPosition }}"
>无部位属性</view>
<view class="position" wx:else></view>
<!-- Price and Count -->
<view class="price_count">
<view class="price">
<text>¥</text>
<input
type="digit"
value="{{ product.sellPrice !== undefined ? product.sellPrice : product.price }}"
bindinput="changePrice"
disabled="{{ selectPayType == 0 || product.goodsPriceModify }}"
bindblur="priceBlur"
class="{{ (product.basePriceError || product.errorTarget) && (selectPayType != 0) ? 'error' : '' }} {{ selectPayType == 0 ? 'disabled' : '' }}"
always-embed
/>
</view>
<!-- Count Trigger -->
<view
class="count"
catchtap="showPopup"
data-show-name="{{ showPopupName }}"
data-type="{{ popupType }}"
data-positionnnum="{{ positionNum }}"
>x {{ count }}</view>
</view>
</view>
<!-- Strategy Box (Discount/Gift) -->
<!-- Only show if NOT disabled or some logic? Original code checks orderType -->
<view class="strategy-box" wx:if="{{ orderType == 2 }}">
<view class="discount-types">
<view class="discount-tabs">
<view
class="type-item {{ (product.discountType == 3 || !product.discountType) ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-type="3"
>无折扣</view>
<view class="type-item {{ product.discountType == 1 ? 'active' : '' }}" catchtap="changeProductDiscountType" data-type="1">折扣比例</view>
<view class="type-item {{ product.discountType == 2 ? 'active' : '' }}" catchtap="changeProductDiscountType" data-type="2">折扣金额</view>
</view>
<view class="discount-input" wx:if="{{ product.discountType == 1 || product.discountType == 2 }}">
<input
type="digit"
placeholder="{{ product.discountType == 1 ? '输入折扣' : '输入金额' }}"
value="{{ product.discountValue }}"
bindinput="inputDiscountValue"
/>
<text> {{product.discountType == 1 ? '折': '元'}}</text>
</view>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{product.finalPrice !== undefined ? product.finalPrice : (product.sellPrice !== undefined ? product.sellPrice : product.price)}}</text>
</view>
</view>
<view class="strategy-box" wx:if="{{ orderType == 3 }}">
<view class="gift-row">
<view>是否为赠品</view>
<radio-group bindchange="toggleGift" class="gift-radios">
<label class="radio-label">
<radio value="1" checked="{{ product.discountType == 4 }}" color="#347BFF" />
是
</label>
<label class="radio-label">
<radio value="0" checked="{{ product.discountType != 4 }}" color="#347BFF" />
否
</label>
</radio-group>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{product.finalPrice !== undefined ? product.finalPrice : (product.sellPrice !== undefined ? product.sellPrice : product.price)}}</text>
</view>
</view>
<view class="strategy-box" wx:if="{{ orderType == 5 }}">
<view class="discount-types">
<view class="discount-tabs">
<view
class="type-item {{ (product.discountType == 3 || !product.discountType) ? 'active' : '' }}"
catchtap="changeProductDiscountType"
data-type="3"
>无抵扣</view>
<view class="type-item {{ product.discountType == 2 ? 'active' : '' }}" catchtap="changeProductDiscountType" data-type="2">抵扣金额</view>
</view>
<view class="discount-input" wx:if="{{ product.discountType == 2 }}">
<input type="digit" placeholder="输入金额" value="{{ product.discountValue }}" bindinput="inputDiscountValue" />
<text>元</text>
</view>
</view>
<view class="final-price">
价格
<text class="orange">¥ {{product.finalPrice !== undefined ? product.finalPrice : (product.sellPrice !== undefined ? product.sellPrice : product.price)}}</text>
</view>
</view>
<!-- Delete Icon (Only if not package sub-item) -->
<view class="icon" bindtap="delGoodsList" wx:if="{{ !isPackageSubItem }}">
<image src="/tabWorkOrder/images/del.png" />
</view>
</view>
\ No newline at end of file
/* components/OrderGoodsRow/order-goods-row.wxss */
.goods {
background: #F7F8FA;
border-radius: 16rpx;
margin: 16rpx 20rpx;
display: flex;
flex-flow: column;
padding: 24rpx;
justify-content: space-between;
font-size: 28rpx;
position: relative;
}
.goods .icon {
position: absolute;
top: 0;
right: 0;
width: 40rpx;
height: 40rpx;
background: rgba(52, 123, 255, 0.1);
border-radius: 0 16rpx 0 16rpx;
display: flex;
align-items: center;
justify-content: center;
}
.goods .icon image {
width: 100%;
height: 100%;
}
.goods .name_box {
width: 100%;
margin-bottom: 8rpx;
}
.goods .name {
color: #FF6601;
width: 100%;
}
.goods .bottom_box {
display: flex;
align-items: center;
justify-content: space-between;
}
.goods .bottom_box .position {
color: #888888;
}
.goods .bottom_box .red_text {
color: red;
}
.goods .bottom_box .price_count {
display: flex;
align-items: center;
justify-content: flex-start;
}
.goods .price {
color: #333333;
width: 240rpx;
height: 64rpx;
background: #FFFFFF;
border: 2rpx solid #E6E6E6;
border-radius: 8rpx;
position: relative;
margin-right: 32rpx;
}
.goods .price text {
position: absolute;
left: 16rpx;
top: 50%;
font-size: 24rpx;
transform: translateY(-50%);
}
.goods .price input {
box-sizing: border-box;
width: 100%;
height: 100%;
text-align: end;
min-height: 100%;
font-size: 28rpx;
padding: 0 16rpx 0 50rpx;
}
.goods .price input.error {
border: 2rpx solid #F24724;
}
.goods .price input.disabled {
background-color: #f0f0f0;
color: #dcdcdc;
}
.goods .count {
min-width: 64rpx;
color: #292D33;
}
.alias {
font-size: 12px;
color: #222222 !important;
}
/* Strategy Box Styles */
.strategy-box {
margin-top: 10rpx;
padding-top: 10rpx;
border-top: 1rpx solid #eee;
}
.strategy-box .discount-types {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
}
.strategy-box .discount-types .discount-tabs {
display: flex;
align-items: center;
background: #e9e9e9;
padding: 6rpx;
border-radius: 8rpx;
}
.strategy-box .discount-types .type-item {
padding: 10rpx 12rpx;
background: transparent;
border-radius: 6rpx;
margin-right: 0;
font-size: 24rpx;
color: #222;
border: none;
}
.strategy-box .discount-types .type-item.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
.strategy-box .discount-types .discount-input {
display: flex;
align-items: center;
margin-left: 10rpx;
background: #fff;
padding: 0 10rpx;
height: 64rpx;
border-radius: 8rpx;
border: 2rpx solid #eff0f2;
}
.strategy-box .discount-types .discount-input input {
width: 160rpx;
border-radius: 0;
padding: 0;
font-size: 24rpx;
height: 100%;
margin-right: 6rpx;
background: transparent;
text-align: left;
}
.strategy-box .discount-types .discount-input text {
font-size: 24rpx;
color: #333;
line-height: 0rpx;
}
.strategy-box .gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
font-size: 28rpx;
/* color: #333; */
color: #222222;
}
.strategy-box .gift-row .gift-radios {
display: flex;
align-items: center;
}
.strategy-box .gift-row .gift-radios .radio-label {
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
}
.strategy-box .gift-row .gift-radios .radio-label radio {
transform: scale(0.6);
}
.strategy-box .final-price {
font-size: 28rpx;
/* color: #666; */
color: #222222;
display: flex;
align-items: center;
justify-content: space-between;
}
.strategy-box .final-price .orange {
color: #FF6601;
font-weight: bold;
font-size: 30rpx;
margin-left: 10rpx;
}
/* Utilities */
.text-hide {
overflow: hidden;
text-overflow: ellipsis;
white-space: nowrap;
}
\ No newline at end of file
......@@ -11,7 +11,8 @@
"van-picker": "@vant/weapp/picker/index",
"van-popup": "@vant/weapp/popup/index",
"set-meal": "/components/SetMeal/SetMeal",
"order-goods-row": "./components/OrderGoodsRow/order-goods-row",
"recording-order-popup": "/tabIndex/components/recordingOrderPopup/recordingOrderPopup",
"study-permission-modal": "/components/studyPermissionModal/studyPermissionModal"
}
}
\ No newline at end of file
}
......@@ -335,6 +335,13 @@ page {
font-weight: 600;
}
.totalPrice {
text-align: right;
color: #347bff;
font-size: 28rpx;
font-weight: 600;
}
.btns {
/* position: fixed;
left: 0;
......@@ -516,7 +523,7 @@ page {
display: flex;
font-weight: 500;
flex-direction: column;
.tradeNo {
max-width: 400rpx;
margin-right: 10rpx;
......@@ -564,13 +571,125 @@ page {
width: var(--fontSize32);
height: var(--fontSize32);
}
.alias{
.alias {
font-size: 12px;
color: #222222!important;
color: #222222 !important;
}
.payment-text {
color: #666666;
}
.required {
color: #f00;
}
.strategy-box {
margin-top: 10rpx;
padding-top: 10rpx;
border-top: 1rpx solid #eee;
.discount-types {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
.discount-tabs {
display: flex;
align-items: center;
background: #e9e9e9;
padding: 6rpx;
border-radius: 8rpx;
}
.type-item {
padding: 10rpx 12rpx;
background: transparent;
border-radius: 6rpx;
margin-right: 0;
font-size: 24rpx;
color: #222;
border: none;
&.active {
background: #fff;
color: #333;
font-weight: 500;
box-shadow: 0 2rpx 4rpx rgba(0, 0, 0, 0.1);
}
}
.discount-input {
display: flex;
align-items: center;
margin-left: 10rpx;
background: #fff;
padding: 0 10rpx;
height: 64rpx;
border-radius: 8rpx;
border: 2rpx solid #eff0f2;
input {
width: 160rpx;
border-radius: 0;
padding: 0;
font-size: 24rpx;
height: 100%;
margin-right: 6rpx;
background: transparent;
text-align: left;
height: 64rpx;
}
text {
font-size: 24rpx;
color: #333;
line-height: 0rpx;
}
}
}
.gift-row {
display: flex;
align-items: center;
justify-content: space-between;
margin-bottom: 10rpx;
font-size: 28rpx;
color: #333;
.gift-radios {
display: flex;
align-items: center;
.radio-label {
margin-left: 20rpx;
display: flex;
align-items: center;
justify-content: space-between;
radio {
transform: scale(0.8);
}
}
}
}
.final-price {
font-size: 26rpx;
color: #666;
display: flex;
align-items: center;
justify-content: space-between;
.orange {
color: #FF6601;
font-weight: bold;
font-size: 30rpx;
margin-left: 10rpx;
}
}
}
\ No newline at end of file
import api from '../../api'
/**
* 路由策略上下文
* 负责根据入参分发到具体的策略处理类
*/
export function RouteContext(page) {
this.page = page
}
/**
* 执行路由逻辑
* @param {Object} res 路由参数
*/
RouteContext.prototype.execute = async function (res) {
// 1. 公共前置处理 (PaymentMethod)
if (res && res.paymentMethod) {
this.page.setData({
paymentMethod: res.paymentMethod
})
}
// 2. 策略匹配与执行
// 优先级:扫码 -> 编辑 -> 补录 -> 商户入口 -> 默认
var strategy
if (res.scene) {
strategy = new ScanCodeStrategy(this.page)
} else if (res.orderCode && res.page) {
strategy = new EditOrderStrategy(this.page)
} else if (res && res.orderCreateType === 'additionRecordOrder') {
strategy = new AdditionRecordStrategy(this.page)
} else if (res.merchantId) {
strategy = new MerchantStrategy(this.page)
} else {
strategy = new DefaultStrategy(this.page)
}
console.log('[RouteStrategy] Matched Strategy', res)
await strategy.run(res)
// 3. 最终通用逻辑 (对应原 onRoute 最后的 getSetting)
this.page.getSetting()
}
/**
* 策略基类
* 定义模板方法和通用处理逻辑
*/
function BaseStrategy(page) {
this.page = page
}
/**
* 模板方法:定义处理流程
* 1. specificHandle: 特定业务逻辑 (可能修改 res 或 setData)
* 2. commonHandle: 通用状态/默认值处理
* 3. finalHandle: 最终收尾 (Loading/Flag/Navigation)
*/
BaseStrategy.prototype.run = async function (res) {
// 步骤1:特定逻辑,返回处理后的 res (因为 Edit 模式可能会替换 res)
// 如果返回 false,则中断后续流程 (例如补录模式下 checkShowOrderInfo 需要中断)
var processedRes = await this.specificHandle(res)
if (processedRes === false) return
var finalRes = processedRes || res
// 步骤2:通用字段与状态处理
this.commonHandle(finalRes)
// 步骤3:收尾逻辑
this.finalHandle(finalRes)
}
BaseStrategy.prototype.specificHandle = async function (res) {
return res
}
/**
* 通用逻辑:默认值、显隐提示、已存在订单判断
* 对应原代码 lines 1840-1861
*/
BaseStrategy.prototype.commonHandle = function (res) {
// 1. 兼容初始化字段默认值
if (res.orderType === undefined || res.orderType === null) res.orderType = 0
if (res.discountType === undefined || res.discountType === null)
res.discountType = 3
// 2. 处理 Tips 和 isAlreadyExistOrder
var data = this.page.data
var tipsProps = data.tipsProps
var isAlreadyExistOrder = data.isAlreadyExistOrder
if (Object.keys(res).length > 0) {
if (res.associateOrderCode || res.associateOrderType) {
// tipsProps.showTips = true;
} else if (res.orderCode || res.againOrder) {
// 以建档(预约列表)/待跟进工单不可建档
isAlreadyExistOrder = true
}
// 注意:这里只是准备数据,建议最后统一 setData,但为了保持逻辑独立,这里先 set
this.page.setData({
tipsProps: tipsProps,
isAlreadyExistOrder: isAlreadyExistOrder
})
}
}
/**
* 默认收尾逻辑:显示 Loading 并设置 flag
* 对应原代码 lines 1882-1892 (else 分支)
*/
BaseStrategy.prototype.finalHandle = function (res) {
wx.$util.showLoading('加载中...')
this.page.setData({ flag: true }, function () {
wx.$util.hideLoading()
})
}
/**
* 策略1:扫码进入
* 对应原代码 lines 1862-1876
*/
function ScanCodeStrategy(page) {
BaseStrategy.call(this, page)
}
// 继承 BaseStrategy
ScanCodeStrategy.prototype = Object.create(BaseStrategy.prototype)
ScanCodeStrategy.prototype.constructor = ScanCodeStrategy
ScanCodeStrategy.prototype.specificHandle = async function (res) {
// 扫码场景逻辑其实主要在 finalHandle 中处理了,但为了结构统一,这里可以做预处理
return res
}
// 覆写收尾逻辑
ScanCodeStrategy.prototype.finalHandle = function (res) {
res.returnFun = true
// 扫描核销进入新建工单 不可建档
var isAlreadyExistOrder = true
// 扫码核销进入不展示补录订单入口
var recordOrderFlag = false
var newData = Object.assign({}, res, {
isAlreadyExistOrder: isAlreadyExistOrder,
recordOrderFlag: recordOrderFlag
})
this.page.setData(newData)
}
/**
* 策略2:编辑/详情模式
* 对应原代码 lines 1830-1838
*/
function EditOrderStrategy(page) {
BaseStrategy.call(this, page)
}
EditOrderStrategy.prototype = Object.create(BaseStrategy.prototype)
EditOrderStrategy.prototype.constructor = EditOrderStrategy
EditOrderStrategy.prototype.specificHandle = async function (res) {
var result = await api.getOrderDetail({
orderCode: res.orderCode
})
console.log('EditOrderStrategy fetch result:', result)
var code = result.code
var data = result.data
if (code == 0) {
// data.customer.customerName = res.customerName // 原代码注释
return data // 返回新的 res 数据源
}
return res
}
/**
* 策略3:补录订单模式
* 对应原代码 lines 1787-1829
*/
function AdditionRecordStrategy(page) {
BaseStrategy.call(this, page)
}
AdditionRecordStrategy.prototype = Object.create(BaseStrategy.prototype)
AdditionRecordStrategy.prototype.constructor = AdditionRecordStrategy
AdditionRecordStrategy.prototype.specificHandle = async function (res) {
var supplementId = res.supplementId
var selectOutTradeNoArr = res.selectOutTradeNoArr
if (supplementId) {
this.page.checkShowOrderInfo()
return false // 中断后续流程
}
// 处理已选的交易参考号数据
var switchValues = new Set(
selectOutTradeNoArr.map(function (item) {
return Number(item.switchValue)
})
)
var switchValue
if (switchValues.size === 1) {
switchValue = switchValues.has(1) ? 1 : 2
} else {
switchValue = null
}
var outTradeNo = selectOutTradeNoArr.reduce(function (str, item, index) {
return str + (index ? ',' + item.outTradeNo : item.outTradeNo)
}, '')
var tradeNo = selectOutTradeNoArr.reduce(function (str, item, index) {
return str + (index ? ',' + item.tradeNo : item.tradeNo)
}, '')
var totalFee = selectOutTradeNoArr.reduce(function (num, item) {
return num + item.totalFee
}, 0)
console.log('AdditionRecordStrategy:', selectOutTradeNoArr, switchValue)
var updateData = {
switchValue: switchValue,
selectOutTradeNoArr: selectOutTradeNoArr,
outTradeNo: outTradeNo,
tradeNo: tradeNo,
'orderObj.outTradeNo': outTradeNo,
'orderObj.tradeNo': tradeNo,
'orderObj.payeeType': 0,
'orderObj.selectPayType':
switchValue == 1 && selectOutTradeNoArr && selectOutTradeNoArr.length == 1
? 1
: 5,
totalFee: totalFee,
showTips: true,
orderCreateType: res && res.orderCreateType
}
this.page.setData(updateData)
return res
}
/**
* 策略4:商户入口
* 对应原代码 lines 1877-1881
*/
function MerchantStrategy(page) {
BaseStrategy.call(this, page)
}
MerchantStrategy.prototype = Object.create(BaseStrategy.prototype)
MerchantStrategy.prototype.constructor = MerchantStrategy
MerchantStrategy.prototype.finalHandle = function (res) {
this.page.setData({
returnFun: true
})
this.page.setOrderObj(res)
}
/**
* 策略5:默认策略
* 仅执行通用逻辑和默认收尾
*/
function DefaultStrategy(page) {
BaseStrategy.call(this, page)
}
DefaultStrategy.prototype = Object.create(BaseStrategy.prototype)
DefaultStrategy.prototype.constructor = DefaultStrategy
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!