|
@@ -1,365 +1,247 @@
|
|
|
<template>
|
|
|
- <div class="authorize-hz" v-if="show">
|
|
|
- <div class="mid">
|
|
|
- <div class="authorize-box">
|
|
|
- <div class="bold">{{ title }}</div>
|
|
|
- <div class="other">
|
|
|
- 感谢您{{ lbsName }}的信任!请您仔细阅读并充分理解我们最新更新的
|
|
|
- <sapn
|
|
|
- v-if="!privacyReminder"
|
|
|
- style="color: #627ecf"
|
|
|
- @click="gotoProtocol('privacyPolicy')"
|
|
|
- >《{{ brandInfo.privacyPolicyName }}》</sapn
|
|
|
- >
|
|
|
- <sapn
|
|
|
- v-if="!protocolReminder"
|
|
|
- style="color: #627ecf"
|
|
|
- @click="gotoProtocol('protocol')"
|
|
|
- >《{{ brandInfo.protocolName }}》</sapn
|
|
|
- >。
|
|
|
- 新的协议政策将不影响您现有的会员权益,您点击“同意”按钮后,将视为同意本次协议更新。
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- <div class="authorize-footer">
|
|
|
- <uni-button class="disagree_btn" @click="handleDisagree"
|
|
|
- >不同意</uni-button
|
|
|
- >
|
|
|
- <uni-button class="agree_btn" @click="handleConfirm">同意</uni-button>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <view class="box" v-if="show" @touchmove.stop.prevent>
|
|
|
+ <view class="boxIn">
|
|
|
+ <view class="content">
|
|
|
+ <image class="commit-star" src="https://cnsh-kerry-crm-prod.oss-cn-shanghai.aliyuncs.com/images/wx-points/points-commit.png"> </image>
|
|
|
+ <image v-if="custTypeId === 0" class="commit-logo-default" src="https://cnsh-kerry-crm-prod.oss-cn-shanghai.aliyuncs.com/images/wx-points/kerry.png"> </image>
|
|
|
+ <image v-else class="commit-logo-ko" src="https://cnsh-kerry-crm-prod.oss-cn-shanghai.aliyuncs.com/images/wx-points/ko.png"> </image>
|
|
|
+ <view class="logo"> </view>
|
|
|
+ <view class="title"> 您有消费积分未领取 </view>
|
|
|
+ <view class="text"> 如您的微信支付积分未到账,请于消费当日申请领取 </view>
|
|
|
+ <view @click="toWxPointsAuth" class="commit-btn" :class="{ 'commit-btn--blue': custTypeId === 1, 'commit-btn--green': custTypeId === 2 }"> 去领取 </view>
|
|
|
+ <image @click="close" class="commit-cancel" src="https://cnsh-kerry-crm-prod.oss-cn-shanghai.aliyuncs.com/images/wx-points/close.svg"> </image>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
+ </view>
|
|
|
</template>
|
|
|
|
|
|
<script>
|
|
|
-// const app = getApp();
|
|
|
-import {
|
|
|
- kipGetBrandInfo,
|
|
|
- kipLogout,
|
|
|
- kipAgreementCheck,
|
|
|
- kipAgreementSave,
|
|
|
-} from '@/utils/api-kip.js';
|
|
|
-
|
|
|
-import CacheTool from '@/utils/cache-tool.js';
|
|
|
-import { isKOMiniApp } from '@/utils/utils.js';
|
|
|
-import uni from '@/utils/uniHooks'
|
|
|
-import { mapState } from "vuex";
|
|
|
-const YES = '1';
|
|
|
-const NO = '0';
|
|
|
+import { mapState } from 'vuex';
|
|
|
+import { kipGetPointsConfig } from '@/utils/api-kip.js';
|
|
|
+const app = getApp();
|
|
|
export default {
|
|
|
- name: 'my-protocol-modal',
|
|
|
- props: {
|
|
|
- title: {
|
|
|
- type: String,
|
|
|
- default: '亲爱的会员',
|
|
|
- },
|
|
|
+ props: {},
|
|
|
+ created() {
|
|
|
+ // this.handleGetPointsConfig()
|
|
|
},
|
|
|
+ watch: {},
|
|
|
data() {
|
|
|
return {
|
|
|
+ pointsConfig: null,
|
|
|
show: false,
|
|
|
- // curMarket: null,
|
|
|
- // brandInfo: null,
|
|
|
- cacheKey: '',
|
|
|
- privacyReminder: true,
|
|
|
- protocolReminder: true,
|
|
|
+ clickToWxPointsAuth: false,
|
|
|
};
|
|
|
},
|
|
|
- mounted() {},
|
|
|
computed: {
|
|
|
- lbsName() {
|
|
|
- if (!this.curMarket) {
|
|
|
- return '';
|
|
|
- }
|
|
|
- const lbsName = this.curMarket?.name || '';
|
|
|
- return lbsName ? `对${lbsName}` : '';
|
|
|
- },
|
|
|
+ // custTypeId: 0 默认版本,1 上海静安 2 上海浦东
|
|
|
...mapState({
|
|
|
- curMarket: (state) => state.curMarket,
|
|
|
- brandInfo: (state) => state.brandInfo,
|
|
|
- groupId: (state) => state.groupId,
|
|
|
- mallid: (state) => state.mallId,
|
|
|
+ // custTypeId: 0
|
|
|
+ custTypeId: (state) => state.custTypeId,
|
|
|
}),
|
|
|
},
|
|
|
methods: {
|
|
|
- gotoProtocol(type) {
|
|
|
- const brandId = this.groupId || uni.getStorageSync('groupId');
|
|
|
- const lbsId = this.mallid || uni.getStorageSync('mallid');
|
|
|
- // uni.navigateTo({
|
|
|
- // url: `/pages/protocol/protocol?type=${type}&brandId=${brandId}&lbsId=${lbsId}&noBtn=1`,
|
|
|
- // });
|
|
|
- window.toWXSendMsg({
|
|
|
- type: 'toPage',
|
|
|
- options: {
|
|
|
- fnName: 'navigateTo',
|
|
|
- url: `/pages/protocol/protocol?type=${type}&brandId=${brandId}&lbsId=${lbsId}&noBtn=1`
|
|
|
- },
|
|
|
+ checkoutLogin() {
|
|
|
+ const pages = getCurrentPages();
|
|
|
+ let url = '/' + pages[pages.length - 1].route;
|
|
|
+ pages[pages.length - 1].$vm.$refs.child.login(url, () => {
|
|
|
+ this.toWxPointsAuth();
|
|
|
});
|
|
|
},
|
|
|
- handleConfirm() {
|
|
|
- this.saveAgreementAction(YES);
|
|
|
- },
|
|
|
- handleDisagree() {
|
|
|
- this.saveAgreementAction(NO);
|
|
|
- },
|
|
|
- open() {
|
|
|
- // 获取当前商场
|
|
|
- const { brandInfo, curMarket } = this;
|
|
|
- const mallid = this.mallid || uni.getStorageSync('mallid');
|
|
|
- const groupId = this.groupId || uni.getStorageSync('groupId');
|
|
|
- if (!groupId || !mallid) {
|
|
|
- console.warn('===>groupId活mallid不存在');
|
|
|
- this.show = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- // 判断是否已登录
|
|
|
- const member = uni.getStorageSync('member');
|
|
|
- if (!member) {
|
|
|
- console.warn('===>没有登录');
|
|
|
- this.show = false;
|
|
|
- return;
|
|
|
- }
|
|
|
- // 找到商场信息
|
|
|
- if (curMarket) {
|
|
|
- this.curMarket = curMarket;
|
|
|
- }
|
|
|
- // 找到品牌信息
|
|
|
- if (brandInfo && brandInfo.id === groupId) {
|
|
|
- this.brandInfo = brandInfo;
|
|
|
- this.checkVersion();
|
|
|
- } else {
|
|
|
- // 根据brandId和lbsId请求
|
|
|
- const params = {
|
|
|
- id: groupId,
|
|
|
- lbsId: mallid,
|
|
|
- };
|
|
|
- kipGetBrandInfo(params)
|
|
|
- .then((resp) => {
|
|
|
- const result = resp.data;
|
|
|
- if (result && result.code === '000000') {
|
|
|
- const brandArray = result.data;
|
|
|
- if (brandArray && brandArray.length > 0 && brandArray[0]) {
|
|
|
- const brandInfo = brandArray[0].brand;
|
|
|
- // 拿到商场信息,版本号
|
|
|
- this.brandInfo = brandInfo;
|
|
|
- // 请求接口判断是否需要弹出
|
|
|
- this.checkVersion();
|
|
|
- // this.show = true;
|
|
|
+ handleGetPointsConfig() {
|
|
|
+ kipGetPointsConfig()
|
|
|
+ .then((resp) => {
|
|
|
+ const result = resp.data;
|
|
|
+ // codes,wxAuth,aliAuth
|
|
|
+ this.pointsConfig = result;
|
|
|
+ if (result) {
|
|
|
+ if (result && result.codes) {
|
|
|
+ // codes,wxAuth,aliAuth
|
|
|
+ this.pointsConfig = result;
|
|
|
+ this.checkoutLogin();
|
|
|
+ } else {
|
|
|
+ if (result.code && result.code === '300000') {
|
|
|
+ this.checkoutLogin();
|
|
|
+ } else {
|
|
|
+ uni.showToast({
|
|
|
+ icon: 'none',
|
|
|
+ mask: true,
|
|
|
+ duration: 2000,
|
|
|
+ title: result.errorMessage || result.message || '出错了,请稍后再试',
|
|
|
+ });
|
|
|
}
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ if (resp.code && resp.code === '300000') {
|
|
|
+ this.checkoutLogin();
|
|
|
} else {
|
|
|
uni.showToast({
|
|
|
- title: result.message,
|
|
|
- duration: 2000,
|
|
|
icon: 'none',
|
|
|
+ mask: true,
|
|
|
+ duration: 2000,
|
|
|
+ title: resp.message,
|
|
|
});
|
|
|
}
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- this.show = false;
|
|
|
- console.error(err);
|
|
|
- uni.showToast({
|
|
|
- title: '请求错误',
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- });
|
|
|
- }
|
|
|
- },
|
|
|
- logout() {
|
|
|
- const member = uni.getStorageSync('member');
|
|
|
- const openid = member ? member.openid : '';
|
|
|
- kipLogout()
|
|
|
- .then((resp) => {
|
|
|
- uni.hideLoading();
|
|
|
- const result = resp.data;
|
|
|
- if (result && (result.code == '000000' || result.code == '300000')) {
|
|
|
- // 用户不同意协议直接静默退出
|
|
|
- // 清除所有缓存,跳转到首页
|
|
|
- // MemberCacheTool.cleanMemberCache(app);
|
|
|
- // KipCacheTool.cleanKipCache();
|
|
|
- // uni.redirectTo({
|
|
|
- // url: '/pages/automatic/automaticIndex',
|
|
|
- // });
|
|
|
- window.toWXSendMsg({
|
|
|
- type: 'logout',
|
|
|
- options: {},
|
|
|
- });
|
|
|
-
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: result.message,
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
}
|
|
|
})
|
|
|
- .catch((err) => {
|
|
|
- uni.hideLoading();
|
|
|
- console.error(err);
|
|
|
+ .catch((e) => {
|
|
|
uni.showToast({
|
|
|
- title: '请求错误',
|
|
|
- duration: 2000,
|
|
|
icon: 'none',
|
|
|
- });
|
|
|
- });
|
|
|
- },
|
|
|
- getKeyByMallid(mallid) {
|
|
|
- if (CacheTool.isShenZhenMallid(mallid)) {
|
|
|
- return 'agreeProtocolSZ';
|
|
|
- } else if (CacheTool.isShenYangMallid(mallid)) {
|
|
|
- return 'agreeProtocolSY';
|
|
|
- }
|
|
|
- return '';
|
|
|
- },
|
|
|
- checkVersion() {
|
|
|
- kipAgreementCheck()
|
|
|
- .then((resp) => {
|
|
|
- const result = resp.data;
|
|
|
- if (result && result.code === '000000') {
|
|
|
- const { agreementStatus, privacyReminder, protocolReminder } =
|
|
|
- result.data || {};
|
|
|
- this.privacyReminder = privacyReminder;
|
|
|
- this.protocolReminder = protocolReminder;
|
|
|
- if (privacyReminder && protocolReminder) {
|
|
|
- this.show = false;
|
|
|
- } else {
|
|
|
- this.show = true;
|
|
|
- }
|
|
|
- } else {
|
|
|
- uni.showToast({
|
|
|
- title: result.message,
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error(err);
|
|
|
- uni.showToast({
|
|
|
+ mask: true,
|
|
|
title: '请求错误',
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
});
|
|
|
});
|
|
|
},
|
|
|
- saveAgreementAction(status) {
|
|
|
- const params = {};
|
|
|
- if (!this.protocolReminder) {
|
|
|
- params.protocolStatus = status;
|
|
|
- }
|
|
|
- if (!this.privacyReminder) {
|
|
|
- params.privacyStatus = status;
|
|
|
+ async toWxPointsAuth() {
|
|
|
+ console.log('授权微信无感积分');
|
|
|
+ if (this.clickToWxPointsAuth) {
|
|
|
+ console.log('授权微信无感积分重复点击');
|
|
|
+ return;
|
|
|
}
|
|
|
- kipAgreementSave(params)
|
|
|
- .then((resp) => {
|
|
|
- const result = resp.data;
|
|
|
- if (!result || result.code !== '000000') {
|
|
|
- uni.showToast({
|
|
|
- title: result.message,
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
- });
|
|
|
- } else {
|
|
|
- // 如果不同意协议则调用退出接口
|
|
|
- this.show = false;
|
|
|
- if (NO === status) {
|
|
|
- this.logout();
|
|
|
- }
|
|
|
- }
|
|
|
- })
|
|
|
- .catch((err) => {
|
|
|
- console.error(err);
|
|
|
- uni.showToast({
|
|
|
- title: '请求错误',
|
|
|
- duration: 2000,
|
|
|
- icon: 'none',
|
|
|
+ await this.handleGetPointsConfig();
|
|
|
+ this.clickToWxPointsAuth = true;
|
|
|
+ var myPluginInterface = requirePlugin('myPlugin');
|
|
|
+ uni.showLoading();
|
|
|
+ const _this = this;
|
|
|
+ await myPluginInterface.getLocation(app.globalData.openId).then((res) => {
|
|
|
+ const that = _this;
|
|
|
+ if (res.return_code === 0) {
|
|
|
+ uni.navigateTo({
|
|
|
+ url: `plugin://myPlugin/index?openid=${app.globalData.openId}&mch_id=${that.pointsConfig.mchId}&member_status=${that.pointsConfig.wxAuth ? 1 : 0}`,
|
|
|
+ success: function () {
|
|
|
+ that.close();
|
|
|
+ uni.hideLoading();
|
|
|
+ that.clickToWxPointsAuth = false;
|
|
|
+ },
|
|
|
});
|
|
|
- });
|
|
|
+ } else if (res.return_code === '102') {
|
|
|
+ uni.showModal({
|
|
|
+ title: '提示',
|
|
|
+ content: '请您在”定位服务“中允许”微信”使用位置信息, 并允许该小程序使用定位功能',
|
|
|
+ showCancel: false,
|
|
|
+ confirmText: '确认',
|
|
|
+ success: function (res) {
|
|
|
+ that.close();
|
|
|
+ that.clickToWxPointsAuth = false;
|
|
|
+ },
|
|
|
+ });
|
|
|
+ uni.hideLoading();
|
|
|
+ } else {
|
|
|
+ that.clickToWxPointsAuth = false;
|
|
|
+ }
|
|
|
+ });
|
|
|
+ },
|
|
|
+ open() {
|
|
|
+ this.show = true;
|
|
|
+ },
|
|
|
+ close() {
|
|
|
+ this.show = false;
|
|
|
},
|
|
|
},
|
|
|
};
|
|
|
</script>
|
|
|
-
|
|
|
-<style lang="less">
|
|
|
-// new
|
|
|
-.authorize-hz {
|
|
|
- background: rgba(0, 0, 0, 0.6);
|
|
|
+<style>
|
|
|
+.box {
|
|
|
position: fixed;
|
|
|
- z-index: 998;
|
|
|
+ z-index: 10000;
|
|
|
+ width: 100vw;
|
|
|
+ height: 100vh;
|
|
|
+ background: rgba(0, 0, 0, 0.7);
|
|
|
+}
|
|
|
+
|
|
|
+.boxIn {
|
|
|
+ position: relative;
|
|
|
width: 100%;
|
|
|
height: 100%;
|
|
|
- left: 0;
|
|
|
- top: 0;
|
|
|
+}
|
|
|
|
|
|
- .mid {
|
|
|
- position: absolute;
|
|
|
- top: 50%;
|
|
|
- left: 50%;
|
|
|
- transform: translateX(-50%) translateY(-50%);
|
|
|
- width: 588px;
|
|
|
- background: #fff;
|
|
|
- border-radius: 17px;
|
|
|
- padding: 56px 44px;
|
|
|
+.content {
|
|
|
+ position: relative;
|
|
|
+ width: calc(100% - 110px);
|
|
|
+ height: 232px;
|
|
|
+ background: #ffffff;
|
|
|
+ border-radius: 8px;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 280px;
|
|
|
+}
|
|
|
|
|
|
- .authorize-box {
|
|
|
- width: 100%;
|
|
|
+.commit-star {
|
|
|
+ position: absolute;
|
|
|
+ width: calc(100vw - 40px);
|
|
|
+ height: calc(48.1vw - 23.6px);
|
|
|
+ top: calc(11.8px - 24.05vw);
|
|
|
+ left: -33px;
|
|
|
+}
|
|
|
|
|
|
- .bold {
|
|
|
- text-align: center;
|
|
|
- color: #333333;
|
|
|
- padding-bottom: 44px;
|
|
|
- }
|
|
|
+.commit-logo-default {
|
|
|
+ width: 84px;
|
|
|
+ height: 20px;
|
|
|
+ position: relative;
|
|
|
+ display: block;
|
|
|
+ top: 15px;
|
|
|
+ left: 30px;
|
|
|
+}
|
|
|
|
|
|
- .other {
|
|
|
- color: #666666;
|
|
|
- line-height: 48px;
|
|
|
- font-size: 28px;
|
|
|
- color: #666666;
|
|
|
- opacity: 1;
|
|
|
- }
|
|
|
+.commit-logo-ko {
|
|
|
+ width: 80px;
|
|
|
+ height: 20px;
|
|
|
+ position: relative;
|
|
|
+ display: block;
|
|
|
+ top: 15px;
|
|
|
+ left: 35px;
|
|
|
+}
|
|
|
|
|
|
- .checkBox {
|
|
|
- display: flex;
|
|
|
- justify-content: flex-start;
|
|
|
- align-items: flex-start;
|
|
|
- margin-top: 40px;
|
|
|
+.logo {
|
|
|
+ height: 35px;
|
|
|
+ border-bottom: 1rpx solid rgba(151, 151, 151, 0.1);
|
|
|
+}
|
|
|
|
|
|
- .popup-a {
|
|
|
- color: #4e99ff;
|
|
|
- text-decoration: underline;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+.title {
|
|
|
+ font-size: 16px;
|
|
|
+ font-weight: 600;
|
|
|
+ color: #333;
|
|
|
+ text-align: center;
|
|
|
+ margin-top: 22px;
|
|
|
+}
|
|
|
|
|
|
- .authorize-footer {
|
|
|
- display: flex;
|
|
|
- justify-content: space-between;
|
|
|
- color: #ffffff;
|
|
|
- margin-top: 56px;
|
|
|
+.text {
|
|
|
+ width: 180px;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 8px;
|
|
|
+ color: #999;
|
|
|
+ font-size: 12px;
|
|
|
+ text-align: center;
|
|
|
+}
|
|
|
|
|
|
- .disagree_btn {
|
|
|
- width: 176px;
|
|
|
- height: 68px;
|
|
|
- line-height: 68px;
|
|
|
- border: 2px solid #b3b3b3;
|
|
|
- border-radius: 34px;
|
|
|
- color: #999999;
|
|
|
- font-size: 30px;
|
|
|
- }
|
|
|
+.commit-btn {
|
|
|
+ width: calc(100vw - 180px);
|
|
|
+ height: 40px;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 17px;
|
|
|
+ line-height: 40px;
|
|
|
+ text-align: center;
|
|
|
+ font-size: 15px;
|
|
|
+ color: #fff;
|
|
|
+ background: #644a79;
|
|
|
+ border-radius: 25px;
|
|
|
+ box-shadow: 3px 3px 12px 0px #644a79;
|
|
|
+}
|
|
|
|
|
|
- .agree_btn {
|
|
|
- width: 286px;
|
|
|
- height: 68px;
|
|
|
- line-height: 68px;
|
|
|
- background: linear-gradient(90deg, #662d91 0%, #1b1464 100%);
|
|
|
- opacity: 0.83;
|
|
|
- border-radius: 34px;
|
|
|
- color: #ffffff;
|
|
|
- font-size: 30px;
|
|
|
- }
|
|
|
+.commit-btn--blue {
|
|
|
+ box-shadow: 3px 3px 12px 0px #13358e;
|
|
|
+ background: #13358e;
|
|
|
+}
|
|
|
|
|
|
- .disabled {
|
|
|
- background: #999999;
|
|
|
- }
|
|
|
- }
|
|
|
- }
|
|
|
+.commit-btn--green {
|
|
|
+ box-shadow: 3px 3px 12px 0px #25673c;
|
|
|
+ background: #25673c;
|
|
|
+}
|
|
|
+
|
|
|
+.commit-cancel {
|
|
|
+ position: relative;
|
|
|
+ display: block;
|
|
|
+ margin: 0 auto;
|
|
|
+ margin-top: 56px;
|
|
|
+ width: 32px;
|
|
|
+ height: 32px;
|
|
|
}
|
|
|
</style>
|