Commit 120e749d by 李嘉林

Merge branch 'xhyx/hotfix' into merge_xh_to_mayi

parents 49aa464f f50a3513
......@@ -35,7 +35,7 @@ export default {
// production: { "mixid":"3QqsFT", "shopid": 1337 },
// production: { "mixid":"notSHOWROOM", "shopid": 1274 }, // 诸色
// production: { "mixid":"LLGW", "shopid": 981 }, // 贺砚堂
// production: { "mixid":"5I5Dyk", "shopid": 1306 }, // 星期八
production: { "mixid":"5I5Dyk", "shopid": 1306 }, // 星期八
// production: { "mixid":"RON", "shopid": 1503 }, // 荣恩
production: { "mixid":"ant", "shopid": 6 }, // 小工蚁
// production: { "mixid":"MetaSense", "shopid": 1237 }, // 册为
......
......@@ -20,6 +20,11 @@ export default {
return requestPOST(`${process.env.OLSHOP_URL}/cms/get_shop_install_pages?homePageFlag=${params.homePageFlag || false}&shopMixId=${params.shopMixId}`,
);
},
// 页面数据V2
themePagesInfoV2(params) {
return requestPOST(`${process.env.OLSHOP_URL}/cms/get_shop_install_pages_v2?homePageFlag=${params.homePageFlag || false}&shopMixId=${params.shopMixId}`,
);
},
// 查单页面
singlePageInfo(params) {
return requestPOST(`${process.env.OLSHOP_URL}/cms/get_shop_page_by_id?id=${params.id}`,
......@@ -89,6 +94,13 @@ export default {
data
);
},
// 进店规则获取门店id预进入门店
getEnterShopIdV1(data) {
return requestPOST(
`${process.env.OLSHOP_URL}/enterShopRule/getEnterShopIdV1`,
data
);
},
// 商城二维码分配组织或跟进人
ShopCodeDistributionOrg(data) {
return requestPOST(
......
......@@ -6,7 +6,7 @@ export default {
},
cancelPayment(options) {
return requestPOST1(
`${process.env.OLSHOP_URL}/pay/payment_cancel?orderSn=${options}`
`${process.env.OLSHOP_URL}/pay/payment_cancel?orderSn=${options.orderSn}&batchNumber=${options.batchNumber}`
);
},
getGiftRechargeOrderQuery(options) {
......
......@@ -11,7 +11,6 @@
"pages/tabBar2/main",
"pages/tabBar3/main",
"pages/tabBar4/main",
"pages/changeAdr/main",
"pages/wxArticle/main",
"pages/userInfo/main",
"pages/memberCode/main",
......
......@@ -22,7 +22,6 @@ export default {
}
},
components: {
// 'area-navigation' : () => import('~/components/theme/components/other/area-navigation')
},
data() {
return {
......
......@@ -8,7 +8,6 @@
"time-limited-discount": "/static/nativeComponents/TimeLimitedDiscount/index",
"waterfall-flow": "/static/nativeComponents/module/WaterfallFlow/index",
"van-button": "/static/vant/button/index",
"area-navigation":"/static/nativeComponents/AreaNavigation/index",
"cube-nav":"/static/nativeComponents/CubeNav/index",
"float-button":"/static/nativeComponents/FloatButton/index",
"goods-search":"/static/nativeComponents/GoodsSearch/index",
......
<template>
<div class="CustomNav" :style="zIndexStyle">
<div v-if="!isPcPlatform" class="CustomNav" :style="zIndexStyle">
<div class="navFixedBg" :style="navFixedBgStyle"></div>
<div class="navBg" :style="navBgStyle">
<div class="content" :style="contentStyle">{{showShopName}}</div>
......@@ -29,15 +29,22 @@ export default {
zIndexStyle: '',
navFixedBgStyle: '',
navBgStyle: '',
contentStyle: ''
contentStyle: '',
isPcPlatform: false, // 是否是PC平台
}
},
created() {
this.getNavbarInfo();
this.initialize();
const deviceInfo = wx.getDeviceInfo()
this.isPcPlatform = ['mac', 'windows'].includes(deviceInfo.platform);
if (!this.isPcPlatform) {
this.getNavbarInfo();
this.initialize();
}
},
onPageScroll(el) {
this.getScroll(el);
if (!this.isPcPlatform) {
this.getScroll(el);
}
},
watch: {
customBgOpacity() {
......
......@@ -71,7 +71,7 @@ export default {
if (imgRgb != 'undefined' && imgRgb != 'null' && imgRgb != '' && imgRgb != null && imgRgb != undefined) {
this.imgRgb = imgRgb;
} else {
this.imgRgb = '#fff';
this.imgRgb = '#333';
}
},
reloadName() {
......
......@@ -17,9 +17,6 @@
<div v-else-if="item1.componentCode == 'ranking-list' && item1.componentInfo.visible == 1">
<ranking-list :datas="item1"></ranking-list>
</div>
<div v-else-if="item1.componentCode == 'area-navigation' && item1.componentInfo.visible == 1">
<area-navigation :datas="item1" :changeLocation="changeLocation"></area-navigation>
</div>
<div v-else-if="item1.componentCode == 'cube-nav' && item1.componentInfo.visible == 1">
<cube-nav :datas="item1"></cube-nav>
</div>
......
......@@ -8,7 +8,6 @@
"time-limited-discount": "/static/nativeComponents/TimeLimitedDiscount/index",
"waterfall-flow": "/static/nativeComponents/module/WaterfallFlow/index",
"van-button": "/static/vant/button/index",
"area-navigation":"/static/nativeComponents/AreaNavigation/index",
"cube-nav":"/static/nativeComponents/CubeNav/index",
"float-button":"/static/nativeComponents/FloatButton/index",
"goods-search":"/static/nativeComponents/GoodsSearch/index",
......
......@@ -190,15 +190,14 @@ function getThemePage({ mixid, shopid }) {
let userId
// 分销员 id
let spokesmanId
let startViewTime = new Date().getTime(); // 进入时间
let endViewTime = null; // 跳出时间
let viewPageList = []; // 两个参数 上一个页面、当前页面
/**
* 全局页面切换监听
*/
wx.onAppRoute(res => {
// 获取当前页面信息
let currentPage = getCurrentPages()
console.log(currentPage,'--currentPage')
console.log(res,'--res')
// let fromPath = currentPage[currentPage.length - 1].__displayReporter.showReferpagepath
console.log(res, '--res')
let whetherToForceLogin = mpApp.globalData.shopInfo && mpApp.globalData.shopInfo.whetherToForceLogin || 0
log.info("wx.onAppRoute", res, mpApp.globalData.shopInfo, whetherToForceLogin, wx.getStorageSync('sessionid'), res.path != "pages/login/main");
console.log(res,mpApp.globalData.shopInfo,whetherToForceLogin,wx.getStorageSync('sessionid'),res.path !="pages/login/main",'---------wx.onAppRoute')
......@@ -253,5 +252,40 @@ wx.onAppRoute(res => {
log.info("mpBehavior.trackPageView",trackPageViewQuery)
console.log("mpBehavior.trackPageView",trackPageViewQuery)
mpBehavior.trackPageView(trackPageViewQuery);
trackPageLeave(res);
})
})
/**
* 页面访问时长埋点
* @param {*} res
*/
function trackPageLeave() {
endViewTime = new Date().getTime();
const duration = endViewTime - startViewTime;
// 获取当前页面信息
let currentPage = getCurrentPages()
if (viewPageList.length == 0) {
viewPageList = [currentPage[currentPage.length - 1]]
} else {
viewPageList = [currentPage[currentPage.length - 1], viewPageList[0]]
}
console.log('trackPageLeave-viewPageList->', viewPageList);
if (!isNaN(duration) && viewPageList.length > 1) {
let pagePath = viewPageList[1].route;
let pageQuery = viewPageList[1].options;
let query = {
title: '',
location: pagePath, // 需要存上一个页面的
path: `${pagePath}${serialize(pageQuery)?('?'+serialize(pageQuery)):''}`,
sales: spokesmanId || "",
userId: userId || "",
lsdcode: getStoreInfo().offlineShopCode,
lsdname: getStoreInfo().offlineShopName,
}
query.amount = duration / 1000
mpBehavior.trackPageLeave(query)
}
console.log('trackPageLeave-duration->', query.amount);
startViewTime = endViewTime;
}
\ No newline at end of file
import Vue from 'vue'
import App from './index'
const app = new Vue(App)
app.$mount()
\ No newline at end of file
{
"usingComponents": {
"van-loading": "/static/vant/loading/index",
"van-icon": "/static/vant/icon/index"
},
"navigationStyle":"custom"
}
\ No newline at end of file
......@@ -7,7 +7,7 @@
</div> -->
<CustomNav :customBgOpacity="customBgOpacity"></CustomNav>
<StoreAddr v-if="showStoreAddr" @toUpdate="reloadEnterShopRule" @toPageLoading="toPageLoading" ref="StoreAddr"></StoreAddr>
<ThemeDataPlant></ThemeDataPlant>
<ThemeDataPlant v-if="!pageLoading"></ThemeDataPlant>
<div v-for="(item,index) in pageData" :key="index">
<div v-if="item.componentCode=='banner' && item.componentInfo.visible == 1">
<banner :datas="item"></banner>
......@@ -21,9 +21,6 @@
<div v-else-if="item.componentCode == 'ranking-list' && item.componentInfo.visible == 1">
<ranking-list :datas="item"></ranking-list>
</div>
<div v-else-if="item.componentCode == 'area-navigation' && item.componentInfo.visible == 1">
<area-navigation :datas="item" :changeLocation="changeLocation"></area-navigation>
</div>
<div v-else-if="item.componentCode == 'cube-nav' && item.componentInfo.visible == 1">
<cube-nav :datas="item"></cube-nav>
</div>
......@@ -207,22 +204,22 @@ export default {
pageInfo: {},
pageData: [],
contentList: [],
themeColor:{
'--main-color':"",
'--minor-color':"",
themeColor: {
'--main-color': "",
'--minor-color': "",
},
changeLocation : '',
beforeScrollTop:0,
changeLocation: '',
beforeScrollTop: 0,
showSpokesManHome: false,//分销商货架是否展示
showMyCard: false,
showHomepage: false,//分销商首页入口
applySucessEntry: false,//成为分销弹框
getDistributorHomepageName: '',//小店入口名称
active:-1,
active: -1,
toHomePage: false,//是否分销隔断
options: 1,
// 新人有礼
newGiftList:[],
newGiftList: [],
newCustomerGiftActivityId: "", //新客活动id
showNewUser: false, //新客有礼入口
showgiftBag: false, //新客礼包弹框
......@@ -240,6 +237,9 @@ export default {
customBgOpacity: true, // 沉浸式风格
reloadPage: false, // 切换门店进入首页重新获取相关配置
showStoreAddr: false,
preEntryStoreId: "", // 预进入门店code
preEntryStore: {}, // 预进入门店
storeDetail: {},
};
},
components:{
......@@ -573,8 +573,6 @@ export default {
}
// 新人有礼弹窗
this.newUserFun();
// 新店调试
this.debugShopFun();
//清除商品列表组件懒加载缓存
// 需清除的缓存keyList
......@@ -594,6 +592,7 @@ export default {
}
}
})
await this.getEnterShopIdV1();
},
setPageLoading() {
setTimeout(() => {
......@@ -620,6 +619,7 @@ export default {
}
},
async enterStoreRule() {
let _this = this;
try {
console.log(wx.getStorageSync("locationObj"),'--locationObj')
let locationObj = wx.getStorageSync("locationObj") ? JSON.parse(wx.getStorageSync("locationObj")) : {};
......@@ -634,36 +634,100 @@ export default {
console.log(`%cgetEnterShopId${JSON.stringify(res)}`,'color:yellow;font-size:20px;')
if (res.data.code == 200) {
let enterShopId = res.data.data;
console.log(enterShopId,'--enterShopId')
if (enterShopId) {
console.log(enterShopId, '--enterShopId');
let storeDetail = await shop.getOfflineStoreDetail({
shopId: enterShopId,
});
if (storeDetail.data.code == 200) {
this.storeDetail = storeDetail.data.data;
}
console.log('enterStoreRule->', this.preEntryStoreId, enterShopId)
if (this.preEntryStoreId && this.preEntryStoreId != enterShopId) {
wx.showModal({
title: '提醒',
content: `当前定位最近门店【${this.storeDetail.shopName}】是否要进入该门店?`,
success (res) {
if (res.confirm) {
_this.enterStore(enterShopId);
} else if (res.cancel) {
console.log('用户点击取消')
_this.setPageLoading();
}
}
})
} else {
await this.enterStore(enterShopId);
}
}
} catch (error) {
console.log('enterStoreRule-error->', error)
}
// this.setPageLoading();
},
async getEnterShopIdV1() {
// 如果url有参数就return
if (this.h5Params && this.h5Params.offlineShopCode) {
return;
}
this.preEntryStoreId = "";
try {
let res = await shop.getEnterShopIdV1({
channelType: 2,
consumerLongitude: "",
consumerLatitude: "",
distributionOfficerShopCode: ""
});
if (res.data.code == 200 && !isNaN(res.data.data - 0)) {
if (res.data.data != null && res.data.data != 'null') {
this.preEntryStoreId = res.data.data;
}
if (this.preEntryStoreId) {
let storeDetail = await shop.getOfflineStoreDetail({
shopId: enterShopId,
shopId: this.preEntryStoreId,
});
if (storeDetail.data.code == 200) {
setStoreInfo({
offlineShopCode: storeDetail.data.data.shopCode,
offlineShopName: storeDetail.data.data.shopName,
});
this.$refs.StoreAddr.reloadName();
console.log("refreshInit--------3")
this.refreshInit();
}
console.log(storeDetail, '-------storeDetail');
let loginUserInfo = wx.getStorageSync("loginUserInfo") || null;
let query2 = {
telephoneNum: loginUserInfo && loginUserInfo.mobilephone,
enterShopSource: "买家直接进入",
hitRule: "首页进入",
shopName: storeDetail.data.data.shopName,
this.storeDetail = storeDetail.data.data;
}
log.info("进店规则-----",query2)
shop.saveEnterShopRecord(query2);
await this.enterStore(this.preEntryStoreId);
}
}
}
} catch (error) {
console.log('getEnterShopIdV1-error->', error)
}
// this.setPageLoading();
},
async enterStore(enterId) {
if (enterId) {
if (this.storeDetail.shopCode) {
setStoreInfo({
offlineShopCode: this.storeDetail.shopCode,
offlineShopName: this.storeDetail.shopName,
});
this.$refs.StoreAddr.reloadName();
console.log("refreshInit--------3")
// this.refreshInit();
let that = this;
console.log("onPullDownRefresh");
console.log("refreshInit--------4")
this.refreshInit();
this.mpApp.pageCallBack = function (params) {
console.log("获取页面数据-3",params)
that.init(params);
};
}
console.log(this.storeDetail, '-------this.storeDetail');
let loginUserInfo = wx.getStorageSync("loginUserInfo") || null;
let query2 = {
telephoneNum: loginUserInfo && loginUserInfo.mobilephone,
enterShopSource: "买家直接进入",
hitRule: "首页进入",
shopName: this.storeDetail.shopName,
}
log.info("进店规则-----",query2)
shop.saveEnterShopRecord(query2);
}
},
getOfflineStoreDetail() {
},
toPageLoading() {
},
......@@ -873,7 +937,7 @@ export default {
app.fenxiaoModel.becomeRelation(extConfig).then(res=>{
log.info('getSpokesmanInit调用becomeRelation')
log.info(res,'getSpokesmanInit-becomeRelation');
if(res) {
if(res && res.data == 'true') {
wx.removeStorage({
key: "becomeInfo"
});
......@@ -1193,6 +1257,9 @@ export default {
} catch (error) {
}
// 新店调试
this.debugShopFun();
this.setPageLoading();
wx.stopPullDownRefresh();
},
ShopCodeDistributionOrg() {
......
......@@ -12,7 +12,6 @@
"waterfall-flow": "/static/nativeComponents/module/WaterfallFlow/index",
"van-button": "/static/vant/button/index",
"van-stepper": "/static/vant/stepper/index",
"area-navigation":"/static/nativeComponents/AreaNavigation/index",
"cube-nav":"/static/nativeComponents/CubeNav/index",
"float-button":"/static/nativeComponents/FloatButton/index",
"goods-search":"/static/nativeComponents/GoodsSearch/index",
......
......@@ -113,7 +113,7 @@ export default {
if(!this.withoutScene) {
return;
}
this.newPageUrl = this.pageUrl;
this.newPageUrl = this.removeEmptyQueryParams(this.pageUrl);
console.log('------------------index----2')
// 进入直播页面调用不息屏api
console.log(this.pageUrl,this.pageUrl.includes('/liveBroadcast/lived'),"this.pageUrl.includes('/liveBroadcast/lived')")
......@@ -163,7 +163,11 @@ export default {
}
},
onLoad(options) {
wx.removeStorageSync("firstView");
let { offlineShopCode, offlineShopName } = getStoreInfo();
// 新用户首次扫码进入此页没缓存认定为第一次访问
if (offlineShopCode) {
wx.removeStorageSync("firstView");
}
console.log(options,'---options')
if(wx.getStorageSync("sessionid")) {
......@@ -502,7 +506,7 @@ export default {
}
}
this.newPageUrl = this.pageUrl;
this.newPageUrl = this.removeEmptyQueryParams(this.pageUrl);
console.log('this.newPageUrl', this.newPageUrl)
// 商品分享进入 (卡片分享、扫码、点击小程序链接)
if (this.newPageUrl.includes('/goods/') && (options.share || options.share_copy)) {
......@@ -716,6 +720,31 @@ export default {
}
return '';
},
// 将多余的参数删除: ?abc=&cba=1 => ?cba=1
removeEmptyQueryParams(url) {
try {
// 分割URL,分离基础URL和查询字符串
const [baseUrl, queryPart] = url.split('?');
// 若没有查询字符串,直接返回基础URL
if (!queryPart) return baseUrl;
// 分割查询字符串为参数数组
const queryParams = queryPart.split('&');
// 过滤掉空值参数
const filteredParams = queryParams.filter(param => {
const [key, value] = param.split('=');
return value;
});
// 重新组合查询字符串并附加到基础URL上
const cleanedQuery = filteredParams.join('&');
return baseUrl + (cleanedQuery ? `?${cleanedQuery}` : '');
} catch (err) {
console.log('parseUrlError:', err);
return url;
}
}
},
onUnload() {
......
......@@ -666,7 +666,7 @@ export default {
app.fenxiaoModel.becomeRelation(wx.getStorageSync("becomeInfo")?JSON.parse(wx.getStorageSync("becomeInfo")):'').then(res=>{
log.info('pushPageType调用becomeRelation-381')
log.info(res,'pushPageType-becomeRelation')
if(res) {
if(res && res.data == 'true') {
wx.removeStorage({
key: "becomeInfo"
});
......
......@@ -282,7 +282,7 @@ export default {
getSpokesmanInit(extConfig) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then(res => {
if (res) {
if (res && res.data == 'true') {
wx.removeStorage({
key: "becomeInfo"
});
......
......@@ -138,7 +138,7 @@ export default {
getSpokesmanInit(extConfig) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then((res) => {
if (res) {
if (res && res.data == 'true') {
wx.removeStorage({
key: "becomeInfo",
});
......
......@@ -138,7 +138,7 @@ export default {
getSpokesmanInit(extConfig) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then((res) => {
if (res) {
if (res && res.data == 'true') {
wx.removeStorage({
key: "becomeInfo",
});
......
......@@ -138,7 +138,7 @@ export default {
getSpokesmanInit(extConfig) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then((res) => {
if (res) {
if (res && res.data == 'true') {
wx.removeStorage({
key: "becomeInfo",
});
......
......@@ -138,7 +138,7 @@ export default {
getSpokesmanInit(extConfig) {
//绑定上下级关系
app.fenxiaoModel.becomeRelation(extConfig).then((res) => {
if (res) {
if (res && res.data == 'true') {
wx.removeStorage({
key: "becomeInfo",
});
......
......@@ -78,6 +78,12 @@
/>
<van-cell class="noSelect" v-else title="生日" value="未设置" is-link />
</div>
<!-- 地区 -->
<div @click="areaShow = true">
<van-cell v-if="userMsg.provinceName" :value="userMsg.provinceName" title="地区" is-link />
<van-cell v-else class="noSelect" value="未设置" title="地区" is-link />
</div>
<div class="line"></div>
<!--手机-->
......@@ -121,6 +127,17 @@
/>
</van-popup>
</div>
<!-- 地区弹出框 -->
<div catchtouchmove="ture">
<van-popup :show="areaShow" position="bottom">
<van-picker
:columns="provinceNameList"
:show-toolbar="true"
@confirm="onConfirmArea"
@cancel="onCancelArea"
/>
</van-popup>
</div>
<!-- <div @click="click">按下试试</div> -->
</div>
</template>
......@@ -131,6 +148,7 @@ import index from "@/api/index";
import { DFSImg } from "@/utils/index";
import { themeColor } from "@/utils/mayi.js";
import { formatTime } from "@/utils/index";
import tool from "@/utils/tool"
const app = getApp()
export default {
name: "userInfo",
......@@ -142,6 +160,8 @@ export default {
realname: "",
mobilephone: "",
nickname: "",
provinceCode: "",
provinceName: ""
},
imgArr: [],
minDate: new Date(1900, 1, 1).getTime(),
......@@ -149,6 +169,9 @@ export default {
birthShow: false,
sex_show: false,
sex_list: ["女", "男", "未设置"],
areaShow: false,
provinceList: null,
provinceNameList: [],
imgNumLimit: 1,
currentTime: new Date().getTime(),
currentTime2: new Date().getTime(),
......@@ -216,12 +239,24 @@ export default {
this.$router.push("/personalCenter");
}
},
getUserMsg() {
async getUserMsg() {
if (!this.provinceList) {
await tool.appArea().then(res => {
this.provinceList = res.province_list || {};
const list = [];
for (const key in this.provinceList) {
const item = this.provinceList[key];
list.push(item);
}
this.provinceNameList = list;
})
}
live.getUserInfo().then((res) => {
let result = res.data.data;
this.userMsg = {
...result,
birth: result.birth ? result.birth.split(" ")[0] : "",
provinceName: this.provinceList[result.provinceCode] || "",
headPortraitUrl: DFSImg(
result.headPortraitUrl,
400,
......@@ -250,6 +285,7 @@ export default {
this.update_info_data.gender = this.userMsg.gender.toString();
this.update_info_data.headPortraitUrl = this.userMsg.headPortraitUrl;
this.update_info_data.realname = this.userMsg.realname;
this.update_info_data.provinceCode = this.userMsg.provinceCode;
if (this.userMsg.nickname == "" || this.userMsg.nickname == " ") {
wx.showToast({
......@@ -314,6 +350,23 @@ export default {
correctTel(val) {
return /^1\d{10}$/.test(val);
},
onConfirmArea(selection) {
const value = selection.mp.detail.value;
let code;
for (const key in this.provinceList) {
const item = this.provinceList[key];
if (item === value) {
code = key;
break;
}
}
this.userMsg.provinceCode = code;
this.userMsg.provinceName = value;
this.areaShow = false;
},
onCancelArea() {
this.areaShow = false;
},
sexTransform(value) {
console.log(value, "--------------249");
if (value == 0) {
......
......@@ -252,7 +252,11 @@ export default {
log.info("支付失败", res, this.options.orderSn);
this.message = "支付失败";
if ((res.errMsg = "requestPayment:fail cancel")) {
wxPay.cancelPayment(this.options.orderSn).then(() => {
const params = {
orderSn: this.options.orderSn,
batchNumber: this.batchNumber
}
wxPay.cancelPayment(params).then(() => {
log.info("取消成功");
});
}
......
......@@ -43,7 +43,6 @@ export const noLoginList = [
"personalCenter-spokesmanCenter-mine-spokesmanHomePage",
"liveBroadcast-lived",
"personalCenter-spokesmanCenter-mine-getBusinessCard",
"changeAdr"
];
// path
export const noLoginListPath = noLoginList.map(item => {
......
{
"component": true,
"usingComponents": {
"van-dialog": "/static/vant/dialog/index",
"van-icon": "/static/vant/icon/index",
"van-sticky":"/static/vant/sticky/index"
}
}
\ No newline at end of file
<!--static/nativeComponents/AreaNavigation/index.wxml-->
<van-sticky offset-top="{{showSpokesManHome?44:0}}" wx:if="{{datas.componentData.scrollPosition}}">
<view class="area-navigation clearfix" style="background-color:{{datas.componentData.backgroundColor}}">
<view style="width:100%;display:flex;">
<view class="area-l" style="font-size:{{datas.componentData.fontSize / 16 + 'em'}};color:{{datas.componentData.fontColor}};font-weight:{{datas.componentData.fontWeight}}" bindtap="changeOtherCity">
<view class="antt ant-gongsidizhi"></view>
<text class="title">{{positionName}}</text>
<van-icon name="arrow-down" style="margin-left:4rpx" />
</view>
<view class="area-r">
<input class="area-search" type="text" bindtap="toSearchPage" style="background-color:{{datas.componentData.searchBgColor}};font-size:{{datas.componentData.searchFontSize / 16 + 'em'}};color:{{datas.componentData.searchFontColor}};font-weight:{{datas.componentData.searchFontWeight}}">
</input>
</view>
</view>
</view>
</van-sticky>
<view wx:if="{{!datas.componentData.scrollPosition}}">
<view class="area-navigation clearfix" style="background-color:{{datas.componentData.backgroundColor}}">
<view style="width:100%;display:flex;">
<view class="area-l" style="font-size:{{datas.componentData.fontSize / 16 + 'em'}};color:{{datas.componentData.fontColor}};font-weight:{{datas.componentData.fontWeight}}" bindtap="changeOtherCity">
<view class="antt ant-gongsidizhi"></view>
<text class="title">{{positionName}}</text>
<van-icon name="arrow-down" style="margin-left:4rpx" />
</view>
<view class="area-r">
<input class="area-search" type="text" style="background-color:{{datas.componentData.searchBgColor}};font-size:{{datas.componentData.searchFontSize / 16 + 'em'}};color:{{datas.componentData.searchFontColor}};font-weight:{{datas.componentData.searchFontWeight}}">
</input>
</view>
</view>
</view>
</view>
<van-dialog
show="{{noShow}}"
use-slot
showConfirmButton="{{false}}"
>
<view class="change-dialog">
<view style="line-height:60rpx">您所在的地区暂未开放</view>
<view class="change-btn">切换其他城市</view>
</view>
</van-dialog>
<van-dialog
show="{{changeShow}}"
use-slot
showConfirmButton="{{false}}"
>
<view class="change-dialog">
<view style="line-height:60rpx">
定位显示为{{ positionCity.regionName }}
</view>
<view class="change-btn line-clamp1" bindtap="changeTo">
切换到{{ positionCity.regionName }}
</view>
<view class="continue line-clamp1" bindtap="continueBrowser">
继续浏览{{ designateAreaObj.regionName }}
</view>
</view>
</van-dialog>
/* static/nativeComponents/AreaNavigation/index.wxss */
@import '../../nicon/iconfont.wxss';
.area-navigation {
width: 100%;
box-sizing: border-box;
padding: 12rpx 24rpx;
z-index: 99999999;
font-size: 32rpx;
top: 0;
}
.area-navigation-margintop {
padding-top: 100rpx;
}
.area-l{
line-height: 60rpx;
}
.area-l .ant-gongsidizhi{
line-height: 60rpx;
float: left;
}
.area-l .title{
display: block;
float: left;
}
.area-r {
margin-left: 20rpx;
flex: 1;
}
.area-search {
width: 100%;
height: 60rpx;
border-radius: 30rpx;
box-sizing: border-box;
padding: 0 24rpx;
line-height: 60rpx;
border: none;
}
.change-dialog {
text-align: center;
padding: 20rpx 80rpx 36rpx !important;
box-sizing: border-box;
}
.change-dialog .continue {
height: 60rpx;
padding: 0 20rpx;
box-sizing: border-box;
width: 100%;
border-radius: 30rpx;
background-color: white;
text-align: center;
line-height: 60rpx;
margin: 20rpx auto 0;
border: 1rpx solid #999;
font-size: 28rpx;
}
.change-dialog .change-btn {
height: 60rpx;
border-radius: 30rpx;
line-height: 60rpx;
margin: 20rpx auto 0;
width: 100%;
box-sizing: border-box;
color: white;
background-color: var(--main-color);
text-align: center;
font-size: 28rpx;
padding: 0 20rpx;
}
\ No newline at end of file
......@@ -363,25 +363,36 @@ const componentOptions = {
}
},
async briefProduct(query) {
await goodsApi.queryBriefProductInfo(query).then(res => {
if (res.data.code == 200) {
let data = res.data.data.list;
let ids = data.map(element => {
let goodsList = this.render ? res.data.list : res.data.data.list;
return element.terminalProductId;
});
const storageIds = this.getStorageSync('ids');
storageIds[this.data.goodsListIndex] = query.terminalProductIds;
this.setStorageSync('ids', storageIds);
const storageDatasList = this.getStorageSync('storageDatasList');
storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData;
this.setStorageSync('storageDatasList', storageDatasList);
this.moreProduct(true);
// FIXME: 原来逻辑
// await goodsApi.queryBriefProductInfo(query).then(res => {
// if (res.data.code == 200) {
// let data = res.data.data.list;
// let ids = data.map(element => {
// let goodsList = this.render ? res.data.list : res.data.data.list;
// return element.terminalProductId;
// });
let storageIds = this.getStorageSync('ids')
storageIds[this.data.goodsListIndex] = ids
this.setStorageSync('ids',storageIds)
// let storageIds = this.getStorageSync('ids')
// storageIds[this.data.goodsListIndex] = ids
// this.setStorageSync('ids',storageIds)
let storageDatasList = this.getStorageSync('storageDatasList')
storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData
this.setStorageSync('storageDatasList',storageDatasList)
// let storageDatasList = this.getStorageSync('storageDatasList')
// storageDatasList[this.data.goodsListIndex] = this.data.datas.componentData
// this.setStorageSync('storageDatasList',storageDatasList)
this.moreProduct(true);
}
});
// this.moreProduct(true);
// }
// });
},
async moreProduct(flag) {
......@@ -415,11 +426,12 @@ const componentOptions = {
goodsList = res.data.data;
let pageGoodsList = this.data.pageGoodsList[this.data.goodsListIndex] || [];
this.goodsListVal(goodsList, 1,flag);
} else {
this.setData({ scrollLoading: false });
}
});
},
goodsListVal(goodsList, type, flag) {
console.log('goodsListVal', goodsList, type, flag);
let { attributeValueList } = this.data.datas.componentData;
goodsList.forEach((item, index) => {
item.marketingTag = item.defaultTags
......@@ -477,7 +489,6 @@ const componentOptions = {
pageGoodsList[that.data.datasIndex] = list;
}
this.setStorageSync('pageGoodsList', pageGoodsList);
console.log('goodsListVal->2', that.data.goodsListIndex, that.data.datasIndex, list)
// 获取是否要开启请求拦截
......@@ -752,7 +763,6 @@ const componentOptions = {
});
},
setStorageSync(key, val) {
console.log('setStorageSync->', this.data.storageKey, key, val)
return wx.setStorageSync(`${this.data.storageKey}_${key}`,val)
},
getStorageSync(key) {
......
......@@ -64,7 +64,7 @@
style="display:grid;grid-template-columns:repeat({{datas.componentData.columnNum}},minmax(0px, 1fr));gap:{{datas.componentData.proGap*2}}rpx;"
>
<view
wx:for="{{pageGoodsList[datasIndex]}}"
wx:for="{{datas.componentData.goodsList}}"
wx:key="index"
class="goods-item {{'goodsItemIndex'+index}}"
style="margin-bottom:20rpx;"
......
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 to comment