Commit 5bc1b82c by 张立顺

fix 弹框滚动问题

1 parent e830f140
Showing 28 changed files with 124 additions and 39 deletions
......@@ -360,6 +360,10 @@ Component({
chooseItem,
});
},
/** 取消时通知父页面关闭弹框 */
onPopupCancel() {
this.triggerEvent('cancel')
},
confirm() {
let { chooseItem, equityFlag } = this.data;
let thisPage = wx.$router.getPageInstance();
......
......@@ -2,6 +2,7 @@
title="选择车型"
show="{{show}}"
bindconfirm="confirm"
bindcancel="onPopupCancel"
height="{{ equityFlag ? '85%' : '90%' }}">
<view class="car-brands-box">
<search-input bindsearch="searchCar" />
......
......@@ -193,6 +193,11 @@ Component({
})
},
/** 取消时通知父页面关闭,便于 page-meta 解锁 */
onPopupCancel() {
this.triggerEvent('cancel')
},
confirm() {
const { orderInfo, customerList } = this.data
const flag = customerList.some((item) => item.active)
......@@ -201,7 +206,6 @@ Component({
}
this.triggerEvent('confirm', orderInfo)
this.setData({ show: false })
}
}
})
<popup title="选择客户" show="{{show}}" bindconfirm="confirm" height="90%">
<popup title="选择客户" show="{{show}}" bindconfirm="confirm" bindcancel="onPopupCancel" height="90%">
<view class="car-brands-box">
<search-input bindsearch="searchCar" />
<view class="car-brands" catchtouchmove="noScroll">
......
......@@ -606,10 +606,10 @@ Component({
goodsList: arr
})
},
/** 取消时通知父页面关闭弹框;内部 show 兼容未绑 cancel 的引用页 */
cancel() {
this.setData({
show: false
})
this.setData({ show: false })
this.triggerEvent('cancel')
},
async confirm() {
let chooseList = await this.getChooseList(true)
......@@ -628,9 +628,7 @@ Component({
goodsList: chooseList
})
this.triggerEvent('confirm', chooseList)
this.setData({
show: false
})
this.setData({ show: false })
}
}
})
......@@ -460,6 +460,10 @@ Component({
} = e.detail
const thisPage = wx.$router.getPageInstance()
thisPage.setCustomerInfo(customer)
this.setData({ customerInfoBox: false })
},
onCustomerInfoCancel() {
this.setData({ customerInfoBox: false })
},
changeGender(e) {
let {
......
......@@ -80,7 +80,7 @@
</view>
<store-referrer-picker bindconfirm="handleSalesChange" show="{{referrerPicker}}" title="{{pointsMultiRole=='N'?'推荐人':'销售顾问/录单员'}}" type="1" orderObj="{{ orderObj }}" pickerListAll="{{employeeList}}" />
<store-referrer-picker bindconfirm="handleDeliveryChange" show="{{deliveryPicker}}" title="交付专员" type="2" orderObj="{{ orderObj }}" pickerListAll="{{employeeList}}" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" apiType="2" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" apiType="2" />
<car-brands show="{{ carBrandBox }}" bindconfirm="chooseCar" carSeriesId="{{ serviceInfo.carSeriesId || '' }}" equityFlag="true" merchantId="{{ userInfo.default4SStoreInfo.merchantId || undefined }}" />
<van-popup show="{{ showSceneSelect }}" position="bottom" bind:close="onCloseSceneSelect">
......
......@@ -270,6 +270,10 @@ Page({
this.setData({
customer
})
this.setData({ customerInfoBox: false })
},
onCustomerInfoCancel() {
this.setData({ customerInfoBox: false })
},
input(e) {
let { value } = e.detail
......
......@@ -56,7 +56,7 @@
</view>
</view>
<merchant-seles show="{{ selesBox }}" title="选择合作门店" sub-title="选择销售顾问" orderObj="{{ orderObj }}" userInfo="{{ userInfo }}" singleSeller="{{ true }}" scene="0" type="1" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" />
<van-popup show="{{ salesTypeShow }}" position="bottom" bind:close="onCloseSaleType">
<van-picker show-toolbar columns="{{ saleTypesList }}" value-key="name" bind:cancel="onCloseSaleType" bind:confirm="onChangeSaleType" />
</van-popup>
......
......@@ -241,6 +241,10 @@ Page({
this.setData({
customer,
});
this.setData({ customerInfoBox: false });
},
onCustomerInfoCancel() {
this.setData({ customerInfoBox: false });
},
input(e) {
let { value } = e.detail;
......
......@@ -95,7 +95,7 @@
</view>
</block>
<merchant-seles show="{{ selesBox }}" title="选择合作门店" sub-title="选择销售顾问" orderObj="{{ orderObj }}" userInfo="{{ userInfo }}" singleSeller="{{ true }}" type="1" scene="0"/>
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" />
<van-popup show="{{ salesTypeShow }}" position="bottom" bind:close="onCloseSaleType">
<van-picker show-toolbar columns="{{ saleTypesList }}" value-key="name" bind:cancel="onCloseSaleType" bind:confirm="onChangeSaleType" />
</van-popup>
\ No newline at end of file
......@@ -1476,6 +1476,9 @@ Page({
firstStepCustomerInfoBox: false,
});
},
handleFirstStepCustomerInfoCancel() {
this.setData({ firstStepCustomerInfoBox: false });
},
/**
* 生命周期函数--监听页面卸载
......
......@@ -137,6 +137,7 @@
wx:if="{{step === 'first'}}"
show="{{firstStepCustomerInfoBox}}"
bindconfirm="handleFirstStepCustomerInfo"
bindcancel="handleFirstStepCustomerInfoCancel"
apiType="2"
/>
......
......@@ -70,6 +70,7 @@ Page({
// 预约提交
chooseCustomerInfo(e) {
let { detail } = e
this.setData({ customerInfoBox: false })
let { inviteObj } = this.data
let params = {
id: detail.id,
......@@ -90,6 +91,9 @@ Page({
}
})
},
onCustomerInfoCancel() {
this.setData({ customerInfoBox: false })
},
/**
* 生命周期函数--监听页面加载
......
......@@ -47,4 +47,4 @@
</scroll-view>
</view>
</view>
<customerInfo wx:if="{{customerInfoBox}}" show="{{customerInfoBox}}" bindconfirm="chooseCustomerInfo" />
\ No newline at end of file
<customerInfo wx:if="{{customerInfoBox}}" show="{{customerInfoBox}}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" />
\ No newline at end of file
......@@ -515,6 +515,11 @@ Component({
couponList: arr,
});
},
/** 取消时通知父页面关闭弹框;内部 show 兼容未绑 cancel 的引用页 */
onPopupCancel() {
this.setData({ show: false })
this.triggerEvent('cancel')
},
confirm() {
let { chooseItem } = this.data;
// customerCouponList
......@@ -525,9 +530,9 @@ Component({
});
}
// console.log(chooseItem)
this.setData({
show: false,
});
const name =
(chooseItem.couponName || '') +
(chooseItem.customerCouponCode || chooseItem.merchantCouponCode || '')
let thisPage = wx.$router.getPageInstance();
let { orderObj } = thisPage.data;
......@@ -542,6 +547,8 @@ Component({
thisPage.setData({
orderObj,
});
this.setData({ show: false });
this.triggerEvent('confirm', { name });
},
},
});
<popup show="{{show}}" title="选择礼券" bindconfirm="confirm">
<popup show="{{show}}" title="选择礼券" bindconfirm="confirm" bindcancel="onPopupCancel">
<view class="coupon-box">
<search-input bindsearch="searchCoupon"></search-input>
<scroll-view class="coupon" scroll-y>
......
......@@ -318,12 +318,6 @@ Component({
console.log(chooseList,'chooseList')
let thisPage = wx.$router.getPageInstance();
if (!selectData.length) return wx.$util.showToast("请勾选套餐");
this.setData({
show: false,
});
thisPage.setData({
packageBox: false,
});
thisPage?.setGoodsTotal && thisPage.setGoodsTotal(chooseList);
thisPage.setData({
goodsList: chooseList,
......@@ -331,13 +325,8 @@ Component({
this.triggerEvent("confirm", chooseList);
},
cancel() {
let thisPage = wx.$router.getPageInstance();
this.setData({
show: false,
});
thisPage.setData({
packageBox: false,
});
this.setData({ show: false })
this.triggerEvent('cancel')
},
},
});
\ No newline at end of file
......@@ -117,6 +117,10 @@ Page({
let { detail } = e
// this.onRoute(detail)
this.setOrderObj(detail)
this.setData({ customerInfoBox: false })
},
onCustomerInfoCancel() {
this.setData({ customerInfoBox: false })
},
closeTips() {
this.setData({
......
......@@ -655,7 +655,7 @@
<view class="modalTips">请修改商品价格,商品总额需等于总价。</view>
</view>
</modal>
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" merchantId="{{ orderObj.merchantId }}" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" merchantId="{{ orderObj.merchantId }}" />
<!-- <order-popup
orderType="{{remarkBox}}"
show="{{remarkBox}}"
......
......@@ -18,6 +18,7 @@ import {
buildOrderPatch,
resolveDefaultSelection
} from './services/merchantStaffSelection'
import { closePagePopupPatch } from './services/pagePopupLock'
import {
PAY_TYPE,
PAY_TYPE_MAP,
......@@ -546,6 +547,16 @@ Page({
this.onRoute(detail)
// 判断一下档案支付方式现在是否还在,在就替换,没有就去掉这个参数
this.settingPayType(detail)
this.setData(closePagePopupPatch('customerInfoBox'))
},
/** 客户档案弹框取消:重置 flag,解除 page-meta 锁页 */
onCustomerInfoCancel() {
this.setData(closePagePopupPatch('customerInfoBox'))
},
/** 通用弹框取消:由 wxml data-popup-key 指定要关闭的字段 */
onPagePopupCancel(e) {
const popupKey = e.currentTarget.dataset.popupKey
this.setData(closePagePopupPatch(popupKey))
},
closeTips() {
this.setData({
......@@ -956,7 +967,8 @@ Page({
console.log(e)
let { carBrand, carType } = e.detail
this.setData({
car: `${carBrand}|${carType}`
car: `${carBrand}|${carType}`,
...closePagePopupPatch('carBrandBox')
})
},
/**
......@@ -967,9 +979,17 @@ Page({
console.log(e)
let { name } = e.detail
this.setData({
couponName: name
couponName: name,
...closePagePopupPatch('couponBox')
})
},
/** 商品/套餐弹框确认后关闭,Goods/SetMeal 已通过 getPageInstance 写入 goodsList */
chooseGoods() {
const patch = {}
if (this.data.goodsBox) Object.assign(patch, closePagePopupPatch('goodsBox'))
if (this.data.packageBox) Object.assign(patch, closePagePopupPatch('packageBox'))
if (Object.keys(patch).length) this.setData(patch)
},
//修改套餐价格
changeMealPrice(e) {
console.log(e)
......@@ -2180,7 +2200,8 @@ Page({
remarkConfirm(e) {
let value = e.detail
this.setData({
['orderObj.remark']: value
['orderObj.remark']: value,
...closePagePopupPatch('showRemark')
})
},
......
......@@ -833,6 +833,8 @@ value="{{ orderObj.remark }}"
<car-brands
show="{{ carBrandBox }}"
bindconfirm="chooseCar"
bindcancel="onPagePopupCancel"
data-popup-key="carBrandBox"
carSeriesId="{{ orderObj.customer.carSeriesId || '' }}"
merchantId="{{ orderObj.merchantId || 0 }}"
/>
......@@ -840,6 +842,8 @@ value="{{ orderObj.remark }}"
wx:if="{{ showRemark }}"
show="{{ showRemark }}"
bindconfirm="remarkConfirm"
bindcancel="onPagePopupCancel"
data-popup-key="showRemark"
placeholder="请填写内容,最多30个字"
maxlength="30"
value="{{ orderObj.remark }}"
......@@ -850,6 +854,8 @@ value="{{ orderObj.remark }}"
class="coupon"
orderCreateType="{{ orderCreateType }}"
bindconfirm="chooseCoupon"
bindcancel="onPagePopupCancel"
data-popup-key="couponBox"
merchantId="{{ orderObj.merchantId || 0 }}"
customerPhone="{{ orderObj.customer.customerPhone }}"
yqMerchantId="{{ orderObj.sellerMerchantId || 0 }}"
......@@ -860,13 +866,15 @@ value="{{ orderObj.remark }}"
show="{{ goodsBox }}"
wx:if="{{ goodsBox }}"
bindconfirm="chooseGoods"
bindcancel="onPagePopupCancel"
data-popup-key="goodsBox"
goodsData="{{ goodsData }}"
chooseGoodsList="{{ goodsList }}"
isSolarFilm="{{ true }}"
baseConfigData="{{ baseConfigData }}"
/>
<sku-goods show="{{ skuGoodsBox }}" sceneType="1" goodsData="{{ skuGoodsData }}" chooseGoodsList="{{ goodsList }}"></sku-goods>
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" />
<van-popup show="{{ showSource }}" position="bottom" bind:close="onCloseSource">
<van-picker
show-toolbar
......@@ -902,6 +910,8 @@ value="{{ orderObj.remark }}"
wx:if="{{ packageBox }}"
show="{{ packageBox }}"
bindconfirm="chooseGoods"
bindcancel="onPagePopupCancel"
data-popup-key="packageBox"
goodsData="{{ goodsData }}"
chooseGoodsList="{{ goodsList }}"
isSolarFilm="{{ true }}"
......
......@@ -62,8 +62,18 @@ function shouldSyncPagePopup(updates) {
})
}
/**
* 返回用于 setData 的关弹框 patch,便于 page-meta 解锁底层滚动
* @param {string} popupKey data 中的弹框字段名
* @returns {object}
*/
function closePagePopupPatch(popupKey) {
return popupKey ? { [popupKey]: false } : {}
}
module.exports = {
PAGE_POPUP_KEYS,
computePagePopupVisible,
shouldSyncPagePopup
shouldSyncPagePopup,
closePagePopupPatch
}
......@@ -5,7 +5,8 @@ import { createRequire } from 'node:module'
const require = createRequire(import.meta.url)
const {
computePagePopupVisible,
shouldSyncPagePopup
shouldSyncPagePopup,
closePagePopupPatch
} = require('../services/pagePopupLock.js')
describe('pagePopupLock', () => {
......@@ -27,4 +28,12 @@ describe('pagePopupLock', () => {
assert.equal(shouldSyncPagePopup({ orderObj: {} }), false)
assert.equal(shouldSyncPagePopup({ pagePopupVisible: true }), false)
})
it('closePagePopupPatch returns false patch for popup key', () => {
assert.deepEqual(closePagePopupPatch('customerInfoBox'), {
customerInfoBox: false
})
assert.deepEqual(closePagePopupPatch(''), {})
assert.deepEqual(closePagePopupPatch(null), {})
})
})
......@@ -238,9 +238,13 @@ Page({
experienceFlag: detail.customer.experienceFlag || 'Y'
},
[prop + '.customerCouponCode']: detail.customerCoupon?.customerCouponCode,
[prop + '.customerCouponId']: detail?.customerCouponId // 客户券id
[prop + '.customerCouponId']: detail?.customerCouponId, // 客户券id
customerInfoBox: false
})
},
onCustomerInfoCancel() {
this.setData({ customerInfoBox: false })
},
showCustomPop(e) {
let { index } = e.currentTarget.dataset
this.setData({
......
......@@ -737,7 +737,7 @@
isSolarFilm="{{ true }}"
baseConfigData="{{ baseConfigData }}"
/>
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" />
<sub-shop-merchant
show="{{ subShopMerchantBox }}"
title="选择二级流量方"
......
......@@ -99,6 +99,10 @@ Page({
chooseCustomerInfo(e) {
let { detail } = e;
this.onRoute(detail);
this.setData({ customerInfoBox: false });
},
onCustomerInfoCancel() {
this.setData({ customerInfoBox: false });
},
closeTips() {
this.setData({
......
......@@ -435,7 +435,7 @@
filmOrder="1"
/>
<goods show="{{ goodsBox }}" bindconfirm="chooseGoods" goodsData="{{ goodsData }}" chooseGoodsList="{{ goodsList }}" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" />
<customerInfo show="{{ customerInfoBox }}" bindconfirm="chooseCustomerInfo" bindcancel="onCustomerInfoCancel" />
<sub-shop-merchant
show="{{ subShopMerchantBox }}"
title="选择二级流量方"
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!