Commit 09141bd3 by 李嘉林

优化

parent 9186e4df
<template> <template>
<div ref="ThemeDataPlant" class="ThemeDataPlant" :style="{ <div ref="ThemeDataPlant" class="ThemeDataPlant" :style="{
'position': pageCode == 14 ? 'fixed' : '', 'position': pageCode == 14 ? 'fixed' : '',
'background-color': pageSettingData.backgroundColor, 'background-color': imgRgb,
'background-image': bacImage, 'background-image': bacImage,
'background-size': pageSettingData.backgroundFit != 'equiratioFill' ? '100% auto' : 'cover', 'background-size': pageSettingData.backgroundFit != 'equiratioFill' ? '100% auto' : 'cover',
'background-repeat': pageSettingData.backgroundFit == 'repeat' ? 'repeat' : 'no-repeat', 'background-repeat': pageSettingData.backgroundFit == 'repeat' ? 'repeat' : 'no-repeat',
...@@ -51,16 +51,17 @@ export default { ...@@ -51,16 +51,17 @@ export default {
this.mpApp.setHomeBgImg = this.setHomeBgImg; this.mpApp.setHomeBgImg = this.setHomeBgImg;
}, },
mounted() { mounted() {
this.bacImage = `url(${this.pageSettingData.backgroundImage})` this.bacImage = `url(${this.pageSettingData.backgroundImage})`;
this.imgRgb = `url(${this.pageSettingData.backgroundColor})`;
}, },
computed: { computed: {
}, },
methods: { methods: {
setHomeBgImg({ backgroundImage, imgRgb }) { setHomeBgImg({ backgroundImage, imgRgb }) {
if (this.pageCode != 1) return;
console.log(imgRgb,'-imgRgb') console.log(imgRgb,'-imgRgb')
this.bacImage = backgroundImage; // this.bacImage = backgroundImage;
this.bacImage = "";
this.imgRgb = imgRgb; this.imgRgb = imgRgb;
} }
} }
......
...@@ -488,7 +488,7 @@ export default { ...@@ -488,7 +488,7 @@ export default {
that.init(this.mpApp.globalData.pageList); that.init(this.mpApp.globalData.pageList);
} else { } else {
this.mpApp.pageCallBack = function (params) { this.mpApp.pageCallBack = function (params) {
console.log("获取页面数据-2") console.log("获取页面数据-2",params)
that.init(params); that.init(params);
}; };
} }
...@@ -641,6 +641,7 @@ export default { ...@@ -641,6 +641,7 @@ export default {
// 设置visible // 设置visible
pageInfo.pageData = this.updateCondition(pageData, ids); pageInfo.pageData = this.updateCondition(pageData, ids);
log.info(showConditionIds, "--------------5454", ids, pageInfo); log.info(showConditionIds, "--------------5454", ids, pageInfo);
console.log(showConditionIds, "--------------5454", ids, pageInfo);
cb(pageInfo) cb(pageInfo)
}, },
checkCondition({ allCondition }) { checkCondition({ allCondition }) {
...@@ -742,11 +743,17 @@ export default { ...@@ -742,11 +743,17 @@ export default {
console.log("home-init"); console.log("home-init");
this.getCartNum(); this.getCartNum();
this.active=checkTabbarPage('/'); this.active=checkTabbarPage('/');
this.setVisible(this.mpApp.globalData.pageList,(res)=>{ this.setVisible(pageList,(res)=>{
this.pageInfo = res; this.pageInfo = res;
if(this.pageInfo.pageSettingData && JSON.parse(this.pageInfo.pageSettingData).topNavStyleType) {
this.customBgOpacity = true;
} else {
this.customBgOpacity = false;
}
console.log(this.customBgOpacity,'-this.customBgOpacity')
this.contentList = JSON.parse(this.pageInfo.pageData); this.contentList = JSON.parse(this.pageInfo.pageData);
this.pageData.push(this.contentList[0]); this.pageData.push(this.contentList[0]);
console.log(this.pageData,'--this.pageData') console.log(this.pageInfo,'--this.pageInfo')
let i = 1; let i = 1;
this.loadComponents(i); this.loadComponents(i);
}); });
...@@ -757,12 +764,6 @@ export default { ...@@ -757,12 +764,6 @@ export default {
this.setPageLoading(); this.setPageLoading();
log.info(app.globalData.shopInfo,'app') log.info(app.globalData.shopInfo,'app')
wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName}) wx.setNavigationBarTitle({title : app.globalData.shopInfo.shopName})
console.log(this.pageInfo.pageSettingData,'-this.pageInfo.pageSettingData')
if(this.pageInfo.pageSettingData && JSON.parse(this.pageInfo.pageSettingData).topNavStyleType) {
this.customBgOpacity = true;
} else {
this.customBgOpacity = false;
}
if(wx.getStorageSync("sessionid")) { if(wx.getStorageSync("sessionid")) {
//清空门店id //清空门店id
wx.setStorageSync(this.$store.state.mixid+'storeId','') wx.setStorageSync(this.$store.state.mixid+'storeId','')
......
...@@ -469,10 +469,12 @@ export default { ...@@ -469,10 +469,12 @@ export default {
}, },
getUserProfile() { getUserProfile() {
log.info('点击了微信一键登录'); log.info('点击了微信一键登录');
console.log('点击了微信一键登录');
wx.showLoading({ wx.showLoading({
title: '登录中...', title: '登录中...',
mask: true mask: true
}) })
console.log('登录中...');
if(this.content&&!this.checked&&this.onceFlag) { if(this.content&&!this.checked&&this.onceFlag) {
wx.hideLoading() wx.hideLoading()
if (this.registerFlag) { if (this.registerFlag) {
...@@ -485,6 +487,7 @@ export default { ...@@ -485,6 +487,7 @@ export default {
} }
return return
} }
console.log('同意协议...',this.userInfo);
if (this.userInfo) { if (this.userInfo) {
if (this.tempData) return this.handleSuccess() if (this.tempData) return this.handleSuccess()
return this.initUserInfo(); return this.initUserInfo();
...@@ -500,6 +503,7 @@ export default { ...@@ -500,6 +503,7 @@ export default {
this.initUserInfo(); this.initUserInfo();
}, },
fail: (e) => { fail: (e) => {
console.log('wx.getUserProfile-fail',e)
log.info('wx.getUserProfile-fail',e) log.info('wx.getUserProfile-fail',e)
wx.hideLoading() wx.hideLoading()
} }
......
...@@ -3,10 +3,65 @@ ...@@ -3,10 +3,65 @@
</template> </template>
<script> <script>
import { formatTime } from "@/utils/index"; import { formatTime, serialize } from "@/utils/index";
import wxPay from "@/api/wxPay"; import wxPay from "@/api/wxPay";
const app = getApp(); const app = getApp();
const { log } = app; const { log } = app;
function fn(_this) {
// _this.message = "支付成功";
if (!_this.options_isCard) {
let query;
if (_this.batchNumber) {
query = {
orderSn: _this.options.orderSn,
batchNumber: _this.batchNumber,
multiMerchantsFlag: 1,
totalMoney: _this.totalMoney,
};
} else {
query = {
orderSn: _this.options.orderSn,
};
}
// sso场景(跳转第三方url)
if (_this.scene == "sso") {
console.log(_this.backUrl,'----------pay--_this.backUrl')
setTimeout(() => {
wx.redirectTo({
url: `../wxArticle/main?from=sso&link=${_this.backUrl}`,
});
}, 500);
return;
}
let params = `?${serialize(query)}`;
if (_this.options.accountBalanceFlag == 1) {
// 余额充值
params+= `&accountBalanceFlag=1&totalMoney=${_this.totalMoney}`
}
if (_this.options.isPayReplace == 1) {
// 好友代付
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/order/payForOrderDetail&params=${JSON.stringify(
query
)}`,
});
return;
}
wx.redirectTo({
url: `/pages/pages_subpack/paySuccess/main${params}`,
});
} else {
let query = {
cardTitle: _this.options_isCardTitle,
};
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/payCardSuccess&params=${JSON.stringify(
query
)}`,
});
}
}
export default { export default {
components: { components: {
// card // card
...@@ -48,7 +103,7 @@ export default { ...@@ -48,7 +103,7 @@ export default {
log.info(JSON.parse(options.ordercode).orderSn); log.info(JSON.parse(options.ordercode).orderSn);
if (JSON.parse(options.ordercode).orderSn) { if (JSON.parse(options.ordercode).orderSn) {
this.totalMoney = Number( this.totalMoney = Number(
JSON.parse(options.ordercode).orderSn.totalAmount JSON.parse(options.ordercode).totalAmount
).toFixed(2); ).toFixed(2);
} else { } else {
this.totalMoney = Number( this.totalMoney = Number(
...@@ -163,60 +218,6 @@ export default { ...@@ -163,60 +218,6 @@ export default {
} catch (err) { } catch (err) {
console.error("subscribeMessage-err", err); console.error("subscribeMessage-err", err);
} }
function fn(_this) {
// _this.message = "支付成功";
if (!_this.options_isCard) {
let query;
if (_this.batchNumber) {
query = {
orderSn: _this.options.orderSn,
batchNumber: _this.batchNumber,
multiMerchantsFlag: 1,
totalMoney: _this.totalMoney,
};
} else {
query = {
orderSn: _this.options.orderSn,
};
}
// sso场景(跳转第三方url)
if (_this.scene == "sso") {
console.log(_this.backUrl,'----------pay--_this.backUrl')
setTimeout(() => {
wx.redirectTo({
url: `../wxArticle/main?from=sso&link=${_this.backUrl}`,
});
}, 500);
return;
}
let params = `?orderSn=${_this.options.orderSn}`;
if (_this.options.accountBalanceFlag == 1) {
// 余额充值
params+= `&accountBalanceFlag=1&totalMoney=${_this.totalMoney}`
}
if (_this.options.isPayReplace == 1) {
// 好友代付
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/order/payForOrderDetail&params=${JSON.stringify(
query
)}`,
});
return;
}
wx.redirectTo({
url: `/pages/pages_subpack/paySuccess/main${params}`,
});
} else {
let query = {
cardTitle: _this.options_isCardTitle,
};
wx.redirectTo({
url: `../index/main?from=wxPay&backpath=/pay/payCardSuccess&params=${JSON.stringify(
query
)}`,
});
}
}
}; };
payData.fail = (res) => { payData.fail = (res) => {
log.info("支付失败", res, this.options.orderSn); log.info("支付失败", res, this.options.orderSn);
...@@ -226,7 +227,9 @@ export default { ...@@ -226,7 +227,9 @@ export default {
log.info("取消成功"); log.info("取消成功");
}); });
} }
// fn(this);
this.toPage(); this.toPage();
}; };
payData.complete = (res) => { payData.complete = (res) => {
log.info("支付completa", res, this.options.orderSn); log.info("支付completa", res, this.options.orderSn);
......
...@@ -45,10 +45,10 @@ Component({ ...@@ -45,10 +45,10 @@ Component({
customMethod() { customMethod() {
console.log("hello world! I am learning 微信小程序"); console.log("hello world! I am learning 微信小程序");
}, },
async bannerChange(val) { bannerChange(val) {
let { newArr } = this.data; let { newArr } = this.data;
console.log(newArr,'-newArr');
let { changeHomePageFlag } = this.data.datas.componentData; let { changeHomePageFlag } = this.data.datas.componentData;
let _this = this;
// 如果开启了修改首页背景图 // 如果开启了修改首页背景图
let imageUrl = `url(${ let imageUrl = `url(${
newArr[val.detail.current].imageUrl newArr[val.detail.current].imageUrl
...@@ -59,28 +59,6 @@ Component({ ...@@ -59,28 +59,6 @@ Component({
backgroundImage: imageUrl, backgroundImage: imageUrl,
imgRgb: newArr[val.detail.current].imgRgb imgRgb: newArr[val.detail.current].imgRgb
}); });
} else {
await wx.request({
url: `${
newArr[val.detail.current].imageUrl
}?x-oss-process=image/average-hue`,
data: {},
header: { "content-type": "application/json" },
method: "GET",
dataType: "json",
responseType: "text",
success: result => {
let imgRgb = `#${result.data.RGB.split("x")[1]}`;
app.setHomeBgImg({
backgroundImage: imageUrl,
imgRgb
});
newArr[val.detail.current].imgRgb = imgRgb;
_this.setData({ newArr });
},
fail: () => {},
complete: () => {}
});
} }
} }
this.setData({ activeIndex: val.detail.current }); this.setData({ activeIndex: val.detail.current });
......
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