Commit a6ee8416 by 岑成威

fixiix:gengxinbug

1 parent 806ffe37
......@@ -115,7 +115,12 @@ Component({
* 组件的方法列表
*/
methods: {
async prefillRecentScene() {
async prefillRecentScene(options = {}) {
const {
refreshGoods = true,
resolveName = false,
onResolved
} = options || {}
const userInfo = wx.$util.getUserInfo() || {}
const thisPage = wx.$router.getPageInstance()
const orderInfo = thisPage?.data?.orderInfo || {}
......@@ -128,12 +133,20 @@ Component({
const recent = res?.code == 0 ? res?.data : null
const baseSceneCode = recent?.baseSceneCode || ''
if (!baseSceneCode) return
thisPage.setData({
'orderInfo.baseSceneCode': baseSceneCode,
'orderInfo.sceneType': recent?.sceneType
}, () => {
// recent 场景回显后,主动触发一次商品池刷新(内部会调用 getSelectOrderGoodsList)
thisPage.resetGoods && thisPage.resetGoods()
await new Promise(resolve => {
thisPage.setData(
{
'orderInfo.baseSceneCode': baseSceneCode,
'orderInfo.sceneType': recent?.sceneType
},
() => {
if (resolveName) this.getUserSceneList()
// recent 场景回显后,主动触发一次商品池刷新(内部会调用 getSelectOrderGoodsList)
if (refreshGoods) thisPage.resetGoods && thisPage.resetGoods()
if (typeof onResolved === 'function') onResolved(baseSceneCode, recent)
resolve()
}
)
})
} catch (e) {}
},
......
......@@ -1039,6 +1039,27 @@ Page({
navigatorNext(obj) {
wx.$router.redirectTo("CarQuotationPay", obj);
},
syncSceneAfterDetailLoaded() {
const firstStep = this.selectComponent("#FirstStep");
if (!firstStep) return;
const { orderInfo, id } = this.data;
if (orderInfo?.baseSceneCode) {
firstStep.getUserSceneList && firstStep.getUserSceneList();
if (id) this.getQuotationInfo(true);
return;
}
firstStep.prefillRecentScene &&
firstStep.prefillRecentScene({
refreshGoods: false,
resolveName: true,
onResolved: () => {
const latestOrderInfo = this.data.orderInfo || {};
if (this.data.id && latestOrderInfo.baseSceneCode) {
this.getQuotationInfo(true);
}
},
});
},
getOrderInfo() {
wx.$util.showLoading("加载中...");
let { id, orderInfo, quotationGoodsList } = this.data;
......@@ -1248,11 +1269,8 @@ Page({
// this.getQuotationInfo()
// 判断有没有勾选商品,有的话调用一下
orderInfo.vdQuotationGoodsList.length && this.totalFee();
// 编辑态:详情回显后如果已有场景编码,则按场景重新拉取商品列表并回显
const { orderInfo: newOrderInfo, id: currentId } = this.data;
if (currentId && newOrderInfo?.baseSceneCode) {
this.getQuotationInfo(true);
}
// 编辑态:详情场景优先;详情没有场景时,再用 recent 场景兜底。
this.syncSceneAfterDetailLoaded();
}
})
.catch((err) => {});
......
......@@ -57,6 +57,10 @@ Page({
{
label: '流量有效性',
single_key: 'trafficEffectivenessName'
},
{
label: "场景名称",
single_key: "baseSceneName",
}
],
// 邀约状态(1待邀约;2已邀约;3取消预约)
......@@ -398,6 +402,33 @@ Page({
now,
});
},
async getSceneNameMap() {
const cachedMap = this.data.sceneNameMap;
if (cachedMap) return cachedMap;
const userInfo = this.data.userInfo || wx.$util.getUserInfo() || {};
try {
const res = await commonApi.getUserScene({
sceneType: String(userInfo.sceneType || ""),
phone: userInfo.phone,
});
const list = res?.code == 0 && Array.isArray(res?.data) ? res.data : [];
const sceneNameMap = list.reduce((map, item) => {
if (item?.baseSceneCode) {
map[item.baseSceneCode] = item.name || item.staffName || "";
}
return map;
}, {});
this.setData({
sceneNameMap,
});
return sceneNameMap;
} catch (e) {
this.setData({
sceneNameMap: {},
});
return {};
}
},
search() {
wx.$dateListRefresh = false;
let { searchObj, userInfo } = this.data;
......@@ -421,7 +452,7 @@ Page({
this.getiIviteRecord();
this.getStatByPeriod();
},
getInviteList() {
async getInviteList() {
this.showLoading && this.showLoading("加载中...");
// console.log(this.showLoading)
let { searchObj, pageNum, keyword, tabIndex, userInfo } = this.data;
......@@ -433,6 +464,7 @@ Page({
// Tab栏 参数inviteMode 2已预约 1待预约
if (tabIndex != 0) obj.inviteMode = tabIndex == 1 ? 2 : 1;
// debugger
const sceneNameMap = await this.getSceneNameMap();
api.getInviteList(obj).then((res) => {
wx.hideLoading();
let { code, data, message } = res;
......@@ -455,6 +487,11 @@ Page({
e.merchantName = e.merchantCoupon.merchantName;
e.yqMerchantName = e.merchantCoupon.yqMerchantName;
}
e.baseSceneName =
e.baseSceneName ||
e.sceneName ||
sceneNameMap[e.baseSceneCode] ||
"";
e.trafficEffectivenessName = {
1: '有效客户',
2: '无效客户'
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!