You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
467 lines
12 KiB
467 lines
12 KiB
<script>
|
|
import Vue from 'vue'
|
|
export default {
|
|
globalData: {
|
|
|
|
url: '',
|
|
v1url: '',
|
|
orderurl: '',
|
|
userurl: '',
|
|
brestUrl: '',
|
|
imgUrl: '',
|
|
imageWxImg: '',
|
|
imageqrImg: '',
|
|
userInfo: "",
|
|
brestUserInfo: '',
|
|
bresthighAgent: '',
|
|
openId: '',
|
|
code: '',
|
|
token: '',
|
|
brestToken: '',
|
|
cityId: '',
|
|
cityName: '',
|
|
longitude: '',
|
|
latitude: '',
|
|
balancePrice: '',
|
|
balanceCardNo: '',
|
|
identificationCode: '',
|
|
//公司id
|
|
companyId: '',
|
|
// h5获取信息
|
|
h5code: '',
|
|
//门店ID
|
|
storeid: '',
|
|
//门店名字
|
|
storename: '',
|
|
//公众号进入值
|
|
accountId: '',
|
|
//个人码key
|
|
gasKey: '',
|
|
//个人码code
|
|
staffCode: '',
|
|
//公众号菜单区分
|
|
accountType: '',
|
|
//区分肯德基 星巴克
|
|
distinguishid: '',
|
|
//千猪下单数据
|
|
qianzhulist: '',
|
|
//星巴克价格
|
|
salesTallPrice: '',
|
|
//第三方嵌入id
|
|
mchId: '',
|
|
//千猪名称
|
|
qianzhuCityName: '重庆市',
|
|
//团油数据
|
|
pelletoilList: '',
|
|
//分享领取次数
|
|
shareNum: 0,
|
|
//是否查询数据
|
|
isSelect: false,
|
|
h5url:'',
|
|
|
|
|
|
},
|
|
onLaunch: function() {
|
|
uni.getSystemInfo({
|
|
success: function(e) {
|
|
// #ifndef MP
|
|
Vue.prototype.StatusBar = e.statusBarHeight;
|
|
if (e.platform == 'android') {
|
|
Vue.prototype.CustomBar = e.statusBarHeight + 50;
|
|
} else {
|
|
Vue.prototype.CustomBar = e.statusBarHeight + 45;
|
|
};
|
|
// #endif
|
|
|
|
// #ifdef MP-WEIXIN
|
|
Vue.prototype.StatusBar = e.statusBarHeight;
|
|
let custom = uni.getMenuButtonBoundingClientRect();
|
|
Vue.prototype.Custom = custom;
|
|
// Vue.prototype.CustomBar = custom.bottom + custom.top - e.statusBarHeight + 4;
|
|
Vue.prototype.CustomBar = custom.height + custom.top - e.statusBarHeight +4;
|
|
|
|
|
|
console.log(custom)
|
|
// #endif
|
|
|
|
|
|
}
|
|
});
|
|
|
|
|
|
/*
|
|
// const methodToPatch = ['navigateTo', 'redirectTo', 'switchTab', 'navigateBack'];
|
|
const methodToPatch = ['navigateTo', 'redirectTo', 'switchTab', ];
|
|
|
|
let arr = [
|
|
// "/subPages/recharge-centre/recharge-centre",//话费充值
|
|
"/pages/user/mineCoupons/mineCoupons",//卡券中心
|
|
"/pages/user/myPromotion/myPromotion",//我的推广
|
|
"/subPages/cardsList/cardsList",//卡管理
|
|
// "/pages/user/deposit/deposit",//积分充值
|
|
"/physical-merchants/address/address",//我的地址
|
|
"/pages/goods/recording/recording",//积分记录
|
|
"../../../subPages/cardsList/cardsList",//卡管理
|
|
"../../user/order_list/order_list",//我的订单
|
|
"../../user/coupon/coupon",//优惠券
|
|
"/pages/user/payActivity/payActivity",//活动券
|
|
"../../login/updatePas/updatePas",//支付密码
|
|
"/physical-merchants/classify/cart/cart",//我的购物车
|
|
|
|
"../order/confirmation",//兑换
|
|
"../coupon-comfirmation/coupon-comfirmation",//天天好券,每日好券
|
|
"/pages/goods/refuel-confirm/refuel-confirm",//加油下单
|
|
"../unionComfirmation/unionComfirmation",//话费充值下单
|
|
"/physical-merchants/settleAccounts/settleAccounts",//实物下单
|
|
"../rec-confirmation/rec-confirmation",//会员充值
|
|
|
|
];
|
|
|
|
|
|
methodToPatch.map(item => {
|
|
uni.addInterceptor(item,{
|
|
invoke(e){
|
|
console.log(e,"e",arr.includes(e.url.split('?')[0]));
|
|
if(!uni.getStorageSync('token')&&arr.includes(e.url.split('?')[0])){
|
|
// #ifdef H5
|
|
uni.navigateTo({
|
|
url: '/pages/login/register'
|
|
})
|
|
// #endif
|
|
// #ifdef MP
|
|
uni.navigateTo({
|
|
url: '/pages/userLogin/userLogin'
|
|
})
|
|
// #endif
|
|
|
|
return false
|
|
}
|
|
|
|
|
|
}
|
|
})
|
|
|
|
}) */
|
|
|
|
},
|
|
onShow: function() {
|
|
let that = this;
|
|
// #ifdef MP
|
|
let accountInfo = uni.getAccountInfoSync();
|
|
|
|
if (accountInfo.miniProgram.envVersion == 'develop' || accountInfo.miniProgram.envVersion == 'trial') {
|
|
this.globalData.url = 'https://hsgcs.dctpay.com/crest';
|
|
this.globalData.v1url = 'https://hsgcs.dctpay.com/v1';
|
|
this.globalData.payurl = 'https://gratia-pay.dctpay.com/crest';
|
|
this.globalData.orderurl = 'https://hsgcs.dctpay.com/order';
|
|
this.globalData.userurl = 'https://hsgcs.dctpay.com/user';
|
|
this.globalData.brestUrl = 'https://hsgcs.dctpay.com/brest';
|
|
this.globalData.imgUrl = 'https://hsgcs.dctpay.com/filesystem/';
|
|
this.globalData.imageWxImg = 'https://hsgcs.dctpay.com/filesystem/wxApplets/';
|
|
this.globalData.imageqrImg = 'https://hsgcs.dctpay.com/filesystem/temporary/';
|
|
this.globalData.h5url = "https://hsgcs.dctpay.com/hsgH5";
|
|
}
|
|
if (accountInfo.miniProgram.envVersion == 'release') {
|
|
this.globalData.url = 'https://hsg.dctpay.com/crest';
|
|
this.globalData.v1url = 'https://hsg.dctpay.com/v1';
|
|
this.globalData.payurl = 'https://pay.dctpay.com/crest';
|
|
this.globalData.orderurl = 'https://hsg.dctpay.com/order';
|
|
this.globalData.userurl = 'https://hsg.dctpay.com/user';
|
|
this.globalData.brestUrl = 'https://hsg.dctpay.com/brest';
|
|
this.globalData.imgUrl = 'https://hsg.dctpay.com/filesystem/';
|
|
this.globalData.imageWxImg = 'https://hsg.dctpay.com/filesystem/wxApplets/';
|
|
this.globalData.imageqrImg = 'https://hsg.dctpay.com/filesystem/temporary/';
|
|
this.globalData.h5url = "https://hsg.dctpay.com/hsgH5" /* 分享需要用到*/
|
|
}
|
|
|
|
|
|
|
|
|
|
// #endif
|
|
// #ifdef H5
|
|
|
|
that.globalData.h5url = "https://hsgcs.dctpay.com/hsgH5";
|
|
that.globalData.url = 'https://hsgcs.dctpay.com/crest';
|
|
that.globalData.v1url = 'https://hsgcs.dctpay.com/v1';
|
|
that.globalData.payurl = 'https://gratia-pay.dctpay.com/crest';
|
|
that.globalData.orderurl = 'https://hsgcs.dctpay.com/order';
|
|
that.globalData.userurl = 'https://hsgcs.dctpay.com/user';
|
|
that.globalData.brestUrl = 'https://hsgcs.dctpay.com/brest';
|
|
that.globalData.imgUrl = 'https://hsgcs.dctpay.com/filesystem/';
|
|
that.globalData.imageWxImg = 'https://hsgcs.dctpay.com/filesystem/wxApplets/';
|
|
that.globalData.imageqrImg = 'https://hsgcs.dctpay.com/filesystem/temporary/';
|
|
|
|
// that.globalData.h5url = "https://hsg.dctpay.com/hsgH5"
|
|
// that.globalData.url = 'https://hsg.dctpay.com/crest';
|
|
// that.globalData.v1url = 'https://hsg.dctpay.com/v1';
|
|
// that.globalData.payurl = 'https://pay.dctpay.com/crest';
|
|
// that.globalData.orderurl = 'https://hsg.dctpay.com/order';
|
|
// that.globalData.userurl = 'https://hsg.dctpay.com/user';
|
|
// that.globalData.brestUrl = 'https://hsg.dctpay.com/brest';
|
|
// that.globalData.imgUrl = 'https://hsg.dctpay.com/filesystem/';
|
|
// that.globalData.imageWxImg = 'https://hsg.dctpay.com/filesystem/wxApplets/';
|
|
// that.globalData.imageqrImg = 'https://hsg.dctpay.com/filesystem/temporary/';
|
|
|
|
|
|
uni.getStorage({
|
|
key: 'openId',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.openId = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
/* uni.getStorage({
|
|
key: 'user',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.userInfo = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'token',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.token = e.data;
|
|
}
|
|
}
|
|
}) */
|
|
|
|
|
|
|
|
uni.getStorage({
|
|
key: 'accountId',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.accountId = e.data;
|
|
that.globalData.accountType = e.data;
|
|
}
|
|
}
|
|
})
|
|
uni.getStorage({
|
|
key: 'gasKey',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.gasKey = e.data;
|
|
}
|
|
}
|
|
})
|
|
uni.getStorage({
|
|
key: 'staffCode',
|
|
success(e) {
|
|
if (e.data) {
|
|
if (that.globalData.accountId == '000001&key' || that.globalData.accountId ==
|
|
'000000&gasKey' || that.globalData.accountId == '000009&key' || that.globalData
|
|
.accountId == '0000010&key') {
|
|
that.globalData.staffCode = e.data;
|
|
} else {
|
|
that.globalData.mchId = e.data;
|
|
}
|
|
}
|
|
}
|
|
})
|
|
|
|
/* uni.getStorage({
|
|
key: 'cityId',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.cityId = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'cityName',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.cityName = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'qianzhuCityName',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.qianzhuCityName = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'companyId',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.companyId = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'latitude',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.latitude = e.data;
|
|
}
|
|
}
|
|
})
|
|
uni.getStorage({
|
|
key: 'longitude',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.longitude = e.data;
|
|
}
|
|
}
|
|
}) */
|
|
|
|
// #endif
|
|
|
|
uni.getStorage({
|
|
key: "user",
|
|
success(e) {
|
|
if(e.data){
|
|
that.globalData.userInfo = e.data
|
|
}
|
|
},
|
|
})
|
|
uni.getStorage({
|
|
key: 'token',
|
|
success(e) {
|
|
if(e.data){
|
|
that.globalData.token = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
uni.getStorage({
|
|
key: 'cityId',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.cityId = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'cityName',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.cityName = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'qianzhuCityName',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.qianzhuCityName = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'companyId',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.companyId = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
uni.getStorage({
|
|
key: 'latitude',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.latitude = e.data;
|
|
}
|
|
}
|
|
})
|
|
uni.getStorage({
|
|
key: 'longitude',
|
|
success(e) {
|
|
if (e.data) {
|
|
that.globalData.longitude = e.data;
|
|
}
|
|
}
|
|
})
|
|
|
|
|
|
},
|
|
onHide: function() {
|
|
}
|
|
}
|
|
</script>
|
|
|
|
<style lang="scss">
|
|
/*每个页面公共css */
|
|
@import "/static/iconfont/font.scss";
|
|
@import "/static/iconfont/cart.scss";
|
|
|
|
@keyframes noticeAnimation {
|
|
from {
|
|
transform: translateX(100rpx);
|
|
}
|
|
|
|
to {
|
|
// transform: translateX(calc(-100% + 150px));
|
|
transform: translateX(-100%);
|
|
}
|
|
}
|
|
|
|
//自定义checkbox的样式( 元素使用的时候就是使用类名:mycheck)
|
|
checkbox.mycheck .wx-checkbox-input,
|
|
checkbox.mycheck .uni-checkbox-input {
|
|
width: 30rpx !important;
|
|
height: 30rpx !important;
|
|
background-color: #ffffff !important;
|
|
border-radius: 50% !important;
|
|
border: solid 1px #cccccc !important;
|
|
overflow: hidden;
|
|
}
|
|
|
|
// 选中后的 对勾样式
|
|
checkbox.mycheck .uni-checkbox-input-checked::before,
|
|
checkbox.mycheck .wx-checkbox-input-checked::before {
|
|
font-size: 38rpx !important; // 对勾大小 30rpx /
|
|
// color: #FFCC1E;
|
|
}
|
|
|
|
|
|
/* 解决小程序和app滚动条的问题 */
|
|
/* #ifdef MP-WEIXIN || APP-PLUS */
|
|
::-webkit-scrollbar {
|
|
display: none;
|
|
}
|
|
|
|
/* #endif */
|
|
/* 解决H5 的问题 */
|
|
/* #ifdef H5 */
|
|
uni-scroll-view .uni-scroll-view::-webkit-scrollbar {
|
|
/* 隐藏滚动条,但依旧具备可以滚动的功能 */
|
|
display: none
|
|
}
|
|
|
|
/* #endif */
|
|
|
|
|
|
|
|
|
|
.cart-num .uni-numbox__minus {
|
|
border-top-left-radius: 10px !important;
|
|
border-bottom-left-radius: 10px !important;
|
|
}
|
|
|
|
.cart-num .uni-numbox-btns {
|
|
background-color: #f6f6f6 !important;
|
|
}
|
|
|
|
.cart-num .uni-numbox__plus {
|
|
border-top-right-radius: 10px !important;
|
|
border-bottom-right-radius: 10px !important;
|
|
}
|
|
</style> |