Commit a6ee8416 by 岑成威

fixiix:gengxinbug

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