Commit 09141bd3 by 李嘉林

优化

parent 9186e4df
<template>
<div ref="ThemeDataPlant" class="ThemeDataPlant" :style="{
'position': pageCode == 14 ? 'fixed' : '',
'background-color': pageSettingData.backgroundColor,
'background-color': imgRgb,
'background-image': bacImage,
'background-size': pageSettingData.backgroundFit != 'equiratioFill' ? '100% auto' : 'cover',
'background-repeat': pageSettingData.backgroundFit == 'repeat' ? 'repeat' : 'no-repeat',
......@@ -51,16 +51,17 @@ export default {
this.mpApp.setHomeBgImg = this.setHomeBgImg;
},
mounted() {
this.bacImage = `url(${this.pageSettingData.backgroundImage})`
this.bacImage = `url(${this.pageSettingData.backgroundImage})`;
this.imgRgb = `url(${this.pageSettingData.backgroundColor})`;
},
computed: {
},
methods: {
setHomeBgImg({ backgroundImage, imgRgb }) {
if (this.pageCode != 1) return;
console.log(imgRgb,'-imgRgb')
this.bacImage = backgroundImage;
// this.bacImage = backgroundImage;
this.bacImage = "";
this.imgRgb = imgRgb;
}
}
......
......@@ -488,7 +488,7 @@ export default {
that.init(this.mpApp.globalData.pageList);
} else {
this.mpApp.pageCallBack = function (params) {
console.log("获取页面数据-2")
console.log("获取页面数据-2",params)
that.init(params);
};
}
......@@ -641,6 +641,7 @@ export default {
// 设置visible
pageInfo.pageData = this.updateCondition(pageData, ids);
log.info(showConditionIds, "--------------5454", ids, pageInfo);
console.log(showConditionIds, "--------------5454", ids, pageInfo);
cb(pageInfo)
},
checkCondition({ allCondition }) {
......@@ -742,11 +743,17 @@ export default {
console.log("home-init");
this.getCartNum();
this.active=checkTabbarPage('/');
this.setVisible(this.mpApp.globalData.pageList,(res)=>{
this.setVisible(pageList,(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.pageData.push(this.contentList[0]);
console.log(this.pageData,'--this.pageData')
console.log(this.pageInfo,'--this.pageInfo')
let i = 1;
this.loadComponents(i);
});
......@@ -757,12 +764,6 @@ export default {
this.setPageLoading();
log.info(app.globalData.shopInfo,'app')
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")) {
//清空门店id
wx.setStorageSync(this.$store.state.mixid+'storeId','')
......
......@@ -469,10 +469,12 @@ export default {
},
getUserProfile() {
log.info('点击了微信一键登录');
console.log('点击了微信一键登录');
wx.showLoading({
title: '登录中...',
mask: true
})
console.log('登录中...');
if(this.content&&!this.checked&&this.onceFlag) {
wx.hideLoading()
if (this.registerFlag) {
......@@ -485,6 +487,7 @@ export default {
}
return
}
console.log('同意协议...',this.userInfo);
if (this.userInfo) {
if (this.tempData) return this.handleSuccess()
return this.initUserInfo();
......@@ -500,6 +503,7 @@ export default {
this.initUserInfo();
},
fail: (e) => {
console.log('wx.getUserProfile-fail',e)
log.info('wx.getUserProfile-fail',e)
wx.hideLoading()
}
......
......@@ -3,10 +3,65 @@
</template>
<script>
import { formatTime } from "@/utils/index";
import { formatTime, serialize } from "@/utils/index";
import wxPay from "@/api/wxPay";
const app = getApp();
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 {
components: {
// card
......@@ -48,7 +103,7 @@ export default {
log.info(JSON.parse(options.ordercode).orderSn);
if (JSON.parse(options.ordercode).orderSn) {
this.totalMoney = Number(
JSON.parse(options.ordercode).orderSn.totalAmount
JSON.parse(options.ordercode).totalAmount
).toFixed(2);
} else {
this.totalMoney = Number(
......@@ -163,60 +218,6 @@ export default {
} catch (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) => {
log.info("支付失败", res, this.options.orderSn);
......@@ -226,7 +227,9 @@ export default {
log.info("取消成功");
});
}
// fn(this);
this.toPage();
};
payData.complete = (res) => {
log.info("支付completa", res, this.options.orderSn);
......
......@@ -45,10 +45,10 @@ Component({
customMethod() {
console.log("hello world! I am learning 微信小程序");
},
async bannerChange(val) {
bannerChange(val) {
let { newArr } = this.data;
console.log(newArr,'-newArr');
let { changeHomePageFlag } = this.data.datas.componentData;
let _this = this;
// 如果开启了修改首页背景图
let imageUrl = `url(${
newArr[val.detail.current].imageUrl
......@@ -59,28 +59,6 @@ Component({
backgroundImage: imageUrl,
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 });
......
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