v1.1
1、提货点 2、客服(腾讯云智服) 3、接口权限控制 4、复制第三方商品可配置 4、优化附件上传配置 5、手机端核销订单 6、手机端订单统计、订单管理 7、短信优化 8、订阅消息全自动化pull/1/MERGE
parent
6685425ae0
commit
8c67e73d43
|
@ -0,0 +1,24 @@
|
|||
.DS_Store
|
||||
node_modules
|
||||
/dist
|
||||
|
||||
# local env files
|
||||
.env.local
|
||||
.env.*.local
|
||||
|
||||
# Log files
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Editor directories and files
|
||||
.idea
|
||||
.vscode
|
||||
*.suo
|
||||
*.ntvs*
|
||||
*.njsproj
|
||||
*.sln
|
||||
*.sw?
|
||||
build.sh
|
||||
.idea
|
||||
unpackage
|
|
@ -162,7 +162,7 @@ export function switchH5Login(){
|
|||
// #endif
|
||||
|
||||
/*
|
||||
* h5切换公众号登陆
|
||||
* h5切换公众号登录
|
||||
* */
|
||||
// #ifdef H5
|
||||
export function switchH5Login() {
|
||||
|
@ -189,9 +189,9 @@ export function logout(){
|
|||
/**
|
||||
* 获取订阅消息id
|
||||
*/
|
||||
export function getTemlIds()
|
||||
export function getTemlIds(data)
|
||||
{
|
||||
return request.get('wechat/teml_ids', {}, { noAuth:true});
|
||||
return request.post('wechat/program/my/temp/list?limit=3&page=1', data , { noAuth:true});
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
13
api/order.js
13
api/order.js
|
@ -168,10 +168,11 @@ export function orderRefundVerify(data) {
|
|||
* 订单确认获取订单详细信息
|
||||
* @param string cartId
|
||||
*/
|
||||
export function orderConfirm(cartId, isNew) {
|
||||
export function orderConfirm(cartId, isNew, addAgain) {
|
||||
return request.post('order/confirm', {
|
||||
cartIds: cartId,
|
||||
isNew: isNew
|
||||
isNew: isNew,
|
||||
addAgain: addAgain
|
||||
}, {}, 1);
|
||||
}
|
||||
|
||||
|
@ -203,3 +204,11 @@ export function orderCreate(key, data) {
|
|||
export function postOrderComputed(key, data) {
|
||||
return request.post("order/computed/" + key, data);
|
||||
}
|
||||
|
||||
/**
|
||||
* 将字符串 转base64
|
||||
* @param object data
|
||||
*/
|
||||
export function qrcodeApi(data) {
|
||||
return request.post('qrcode/str2base64', data, {}, 1);
|
||||
}
|
|
@ -24,7 +24,7 @@ export function getWechatConfig() {
|
|||
export function wechatAuth(code, spread, login_type) {
|
||||
return request.get(
|
||||
"wechat/authorize/login",
|
||||
{ code, spread, login_type },
|
||||
{ code, spread_spid:spread, login_type },
|
||||
{ noAuth: true }
|
||||
);
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ export function getLogo()
|
|||
|
||||
/**
|
||||
* 小程序用户登录
|
||||
* @param data object 小程序用户登陆信息
|
||||
* @param data object 小程序用户登录信息
|
||||
*/
|
||||
export function login(code,data) {
|
||||
return request.post("wechat/authorize/program/login?code="+code, data, { noAuth : true });
|
||||
|
|
|
@ -325,7 +325,7 @@ export function getRechargeApi() {
|
|||
}
|
||||
|
||||
/**
|
||||
* 登陆记录
|
||||
* 登录记录
|
||||
*/
|
||||
export function setVisit(data)
|
||||
{
|
||||
|
|
|
@ -98,7 +98,7 @@
|
|||
})
|
||||
},
|
||||
setUserInfo(){
|
||||
uni.showLoading({title:'正在登陆中'});
|
||||
uni.showLoading({title:'正在登录中'});
|
||||
Routine.getCode().then(code=>{
|
||||
this.getUserInfo(code);
|
||||
}).catch(res=>{
|
||||
|
|
|
@ -103,7 +103,7 @@
|
|||
setUserInfo(e){
|
||||
console.log('78878787');
|
||||
console.log(e);
|
||||
uni.showLoading({title:'正在登陆中'});
|
||||
uni.showLoading({title:'正在登录中'});
|
||||
if(e.detail.errMsg == "getPhoneNumber:ok"){
|
||||
console.log('授权成功');
|
||||
Routine.getCode().then(code=>{
|
||||
|
|
|
@ -96,4 +96,7 @@
|
|||
line-height: 86rpx;
|
||||
box-sizing: border-box;
|
||||
}
|
||||
.pictrue image{
|
||||
background: #f4f4f4;
|
||||
}
|
||||
</style>
|
||||
|
|
|
@ -73,6 +73,7 @@
|
|||
width: 100%;
|
||||
height: 100%;
|
||||
border-radius: 50%;
|
||||
background: #f4f4f4;
|
||||
}
|
||||
|
||||
.evaluateWtapper .evaluateItem .pic-text .name {
|
||||
|
|
|
@ -20,7 +20,7 @@ module.exports = {
|
|||
//<2F><>ȨlogoС<6F><D0A1><EFBFBD><EFBFBD>
|
||||
LOGO_URL: 'LOGO_URL',
|
||||
//模板缓存
|
||||
SUBSCRIBE_MESSAGE: 'SUBSCRIBE_MESSAGE',
|
||||
// SUBSCRIBE_MESSAGE: 'SUBSCRIBE_MESSAGE',
|
||||
|
||||
TIPS_KEY: 'TIPS_KEY',
|
||||
|
||||
|
|
|
@ -153,13 +153,14 @@ class AuthWechat {
|
|||
}
|
||||
|
||||
/**
|
||||
* 授权登陆获取token
|
||||
* 授权登录获取token
|
||||
* @param {Object} code
|
||||
*/
|
||||
auth(code) {
|
||||
return new Promise((resolve, reject) => {
|
||||
let loginType = Cache.get(LOGINTYPE);
|
||||
wechatAuth(code, parseInt(Cache.get("spread")), loginType)
|
||||
alert(Cache.get("spread"))
|
||||
wechatAuth(code, Cache.get("spread"), loginType)
|
||||
.then(({
|
||||
data
|
||||
}) => {
|
||||
|
@ -173,6 +174,7 @@ class AuthWechat {
|
|||
});
|
||||
Cache.set(WX_AUTH, code);
|
||||
Cache.clear(STATE_KEY);
|
||||
// Cache.clear('spread');
|
||||
loginType && Cache.clear(LOGINTYPE);
|
||||
resolve();
|
||||
})
|
||||
|
@ -204,7 +206,7 @@ class AuthWechat {
|
|||
}
|
||||
|
||||
/**
|
||||
* 跳转自动登陆
|
||||
* 跳转自动登录
|
||||
*/
|
||||
toAuth() {
|
||||
let that = this;
|
||||
|
@ -223,10 +225,6 @@ class AuthWechat {
|
|||
return new Promise((resolve, reject) => {
|
||||
let configDefault = {
|
||||
fail(res) {
|
||||
console.log('前解放后的金凤凰3');
|
||||
console.log(res);
|
||||
console.log(that.instance);
|
||||
console.log('前解放后的金凤凰2');
|
||||
if (that.instance) return reject({
|
||||
is_ready: true,
|
||||
wx: that.instance
|
||||
|
@ -236,9 +234,6 @@ class AuthWechat {
|
|||
is_ready: true,
|
||||
wx: wx
|
||||
});
|
||||
console.log('么么么么1');
|
||||
console.log(wx);
|
||||
console.log('么么么么2');
|
||||
})
|
||||
},
|
||||
success(res) {
|
||||
|
|
3
main.js
3
main.js
|
@ -3,8 +3,11 @@ import App from './App'
|
|||
import store from './store'
|
||||
import Cache from './utils/cache'
|
||||
import util from 'utils/util'
|
||||
import configs from './config/app.js'
|
||||
|
||||
|
||||
Vue.prototype.$util = util;
|
||||
Vue.prototype.$config = configs;
|
||||
Vue.prototype.$Cache = Cache;
|
||||
Vue.prototype.$eventHub = new Vue();
|
||||
Vue.config.productionTip = false
|
||||
|
|
|
@ -68,6 +68,13 @@
|
|||
"desc" : "你的位置信息将用于和门店的距离长度"
|
||||
}
|
||||
},
|
||||
// "plugins" : {
|
||||
// "chat" : {
|
||||
// "version" : "1.0.8",
|
||||
// "provider" : "wx738958e0f4c894f9"
|
||||
// }
|
||||
// },
|
||||
// "sitemapLocation" : "sitemap.json",
|
||||
"usingComponents" : true
|
||||
},
|
||||
"mp-alipay" : {
|
||||
|
|
|
@ -109,7 +109,7 @@
|
|||
// #endif
|
||||
}
|
||||
}
|
||||
],
|
||||
],
|
||||
"subPackages": [
|
||||
{
|
||||
"root": "pages/users",
|
||||
|
|
|
@ -216,6 +216,8 @@
|
|||
|
||||
<script>
|
||||
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
||||
// import yzf_chat from '@/plugin/chat/yzf_chat.js'
|
||||
import store from '@/store';
|
||||
import {
|
||||
HTTP_REQUEST_URL
|
||||
} from '@/config/app.js';
|
||||
|
@ -303,7 +305,7 @@
|
|||
sharePacket: {
|
||||
isState: true, //默认不显示
|
||||
}, //分销商详细
|
||||
uid: 0, //用户uid
|
||||
// uid: 0, //用户uid
|
||||
circular: false,
|
||||
autoplay: false,
|
||||
interval: 3000,
|
||||
|
@ -346,8 +348,9 @@
|
|||
imgTop:''
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin']),
|
||||
computed: mapGetters(['isLogin', 'uid', 'chatUrl']),
|
||||
onLoad(options) {
|
||||
// this.getChat(this.uid || '');
|
||||
let that = this
|
||||
var pages = getCurrentPages();
|
||||
if (pages.length <= 1) {
|
||||
|
@ -384,7 +387,7 @@
|
|||
} else {
|
||||
this.id = options.id
|
||||
}
|
||||
//记录推广人uid
|
||||
//记录推广人
|
||||
if (options.spid) app.globalData.spid = options.spid;
|
||||
// #endif
|
||||
this.getGoodsDetails();
|
||||
|
@ -414,10 +417,32 @@
|
|||
},
|
||||
// #endif
|
||||
methods: {
|
||||
getChat(uid){
|
||||
console.log(this.uid)
|
||||
window.yzf && window.yzf.init({
|
||||
sign: '37ef9b97872756ce2a1596ec4fe9b66b0b4cbeec7b36239a65924fa6cbd5c29ac6b013c274511b2eee929e72312baeeeb97aae86',
|
||||
token: '', //非必填
|
||||
userAvator:'', //非必填,用户头像
|
||||
userNick:'', //非必填,用户昵称
|
||||
uid: uid, //用户唯一标识,如果没有则不填写,默认为空,(字符串格式)
|
||||
title: '', //非必填,如果未填写,默认获取配置标题
|
||||
isRMB: '', //商品是否显示人民币¥,默认显示,false不显示
|
||||
data: {
|
||||
c1: '',
|
||||
c2: '',
|
||||
c3: '',
|
||||
c4: '',
|
||||
c5: ''
|
||||
},
|
||||
selector: 'chat-btn',
|
||||
callback: function(type, data){}
|
||||
})
|
||||
},
|
||||
kefuClick(){
|
||||
return this.$util.Tips({
|
||||
title: '客服功能正在开发中......'
|
||||
});
|
||||
location.href = this.chatUrl;
|
||||
// return this.$util.Tips({
|
||||
// title: '客服功能正在开发中......'
|
||||
// });
|
||||
},
|
||||
closeChange: function() {
|
||||
this.$set(this.sharePacket, 'isState', true);
|
||||
|
@ -483,6 +508,12 @@
|
|||
*去商品详情页
|
||||
*/
|
||||
goDetail(item) {
|
||||
if(!item.activity){
|
||||
uni.redirectTo({
|
||||
url: '/pages/goods_details/index?id=' + item.id
|
||||
})
|
||||
return
|
||||
}
|
||||
if (item.activity.length == 0) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/goods_details/index?id=' + item.id
|
||||
|
@ -526,7 +557,8 @@
|
|||
let that = this;
|
||||
getUserInfo().then(res => {
|
||||
that.$set(that.sharePacket, 'isState', that.sharePacket.priceName != 0 ? false : true);
|
||||
that.$set(that, 'uid', res.data.uid);
|
||||
store.commit('SETUID', res.data.uid);
|
||||
// that.$set(that, 'uid', res.data.uid);
|
||||
// #ifdef H5
|
||||
that.make(res.data.uid);
|
||||
// #endif
|
||||
|
@ -636,6 +668,7 @@
|
|||
that.$set(that.attr, 'productAttr', res.data.productAttr);
|
||||
that.$set(that, 'productValue', res.data.productValue);
|
||||
that.$set(that.sharePacket, 'priceName', res.data.priceName);
|
||||
console.log(that.sharePacket)
|
||||
that.$set(that, 'systemStore', res.data.system_store);
|
||||
that.$set(that, 'good_list', goodArray);
|
||||
that.$set(that, 'activity', res.data.activity ? res.data.activity : []);
|
||||
|
@ -947,7 +980,7 @@
|
|||
that.attr.cartAttr = false;
|
||||
if (news) {
|
||||
uni.navigateTo({
|
||||
url: '/pages/users/order_confirm/index?new=true&cartId=' + res.data.cartId
|
||||
url: '/pages/users/order_confirm/index?new=true&cartId=' + res.data.cartId
|
||||
});
|
||||
} else {
|
||||
that.$util.Tips({
|
||||
|
@ -1209,6 +1242,9 @@
|
|||
</script>
|
||||
|
||||
<style scoped lang="scss">
|
||||
.chat-btn{
|
||||
background-color: antiquewhite !important;
|
||||
}
|
||||
.activity_pin {
|
||||
width: auto;
|
||||
height: 44rpx;
|
||||
|
|
|
@ -464,6 +464,12 @@
|
|||
*去商品详情页
|
||||
*/
|
||||
goDetail(item) {
|
||||
if(!item.activity){
|
||||
uni.redirectTo({
|
||||
url: '/pages/goods_details/index?id=' + item.id
|
||||
})
|
||||
return
|
||||
}
|
||||
if (item.activity.length == 0) {
|
||||
uni.redirectTo({
|
||||
url: '/pages/goods_details/index?id=' + item.id
|
||||
|
|
|
@ -40,7 +40,7 @@
|
|||
<block v-for="(item,index) in imgUrls" :key="index">
|
||||
<swiper-item>
|
||||
<navigator :url='item.url' class='slide-navigator acea-row row-between-wrapper' hover-class='none'>
|
||||
<image :src="item.pic" class="slide-image"></image>
|
||||
<image :src="item.pic" class="slide-image" lazy-load></image>
|
||||
</navigator>
|
||||
</swiper-item>
|
||||
</block>
|
||||
|
@ -224,6 +224,7 @@
|
|||
|
||||
<script>
|
||||
import Auth from '@/libs/wechat';
|
||||
import Cache from '../../utils/cache';
|
||||
var statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
|
||||
let app = getApp();
|
||||
import {
|
||||
|
@ -235,10 +236,10 @@
|
|||
getTemlIds
|
||||
// getLiveList
|
||||
} from '@/api/api.js';
|
||||
import {
|
||||
SUBSCRIBE_MESSAGE,
|
||||
TIPS_KEY
|
||||
} from '@/config/cache';
|
||||
// import {
|
||||
// SUBSCRIBE_MESSAGE,
|
||||
// TIPS_KEY
|
||||
// } from '@/config/cache';
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
import {
|
||||
|
@ -280,6 +281,7 @@
|
|||
import {
|
||||
getWechatConfig
|
||||
} from "@/api/public";
|
||||
const arrTemp = ["paySubscribe","orderSubscribe","extrctSubscribe", "orderRefundSubscribe", "rechargeSubscribe"];
|
||||
export default {
|
||||
computed: mapGetters(['isLogin', 'uid']),
|
||||
components: {
|
||||
|
@ -413,14 +415,21 @@
|
|||
methods: {
|
||||
// #ifdef MP
|
||||
getTemlIds() {
|
||||
let messageTmplIds = wx.getStorageSync(SUBSCRIBE_MESSAGE);
|
||||
if (!messageTmplIds) {
|
||||
getTemlIds().then(res => {
|
||||
if (res.data)
|
||||
wx.setStorageSync(SUBSCRIBE_MESSAGE, JSON.stringify(res.data));
|
||||
})
|
||||
for (var i in arrTemp) {
|
||||
this.getTem(arrTemp[i]);
|
||||
}
|
||||
},
|
||||
getTem(data){
|
||||
getTemlIds({status:true,type:data}).then(res => {
|
||||
if (res.data) {
|
||||
let arr = res.data.map((item) => {
|
||||
return item.tempId
|
||||
})
|
||||
//console.log(arr)
|
||||
wx.setStorageSync('tempID'+ data, arr);
|
||||
}
|
||||
})
|
||||
},
|
||||
// #endif
|
||||
// 关闭优惠券弹窗
|
||||
onColse() {
|
||||
|
@ -608,6 +617,14 @@
|
|||
// #endif
|
||||
})
|
||||
},
|
||||
getChatUrL() {
|
||||
getWechatConfig().then(res => {
|
||||
let data = res.data;
|
||||
this.$store.commit("SET_CHATURL", data.yzfUrl);
|
||||
Cache.set('chatUrl', data.yzfUrl);
|
||||
console.log(data)
|
||||
})
|
||||
},
|
||||
// setOpenShare:function(mss){
|
||||
// getWechatConfig()
|
||||
// .then(res => {
|
||||
|
@ -685,7 +702,7 @@
|
|||
// #ifdef H5
|
||||
uni.showModal({
|
||||
title: '提示',
|
||||
content: '您未登陆,请登陆!',
|
||||
content: '您未登录,请登录!',
|
||||
success: function(res) {
|
||||
if (res.confirm) {
|
||||
uni.navigateTo({
|
||||
|
@ -746,6 +763,7 @@
|
|||
mounted() {
|
||||
let self = this
|
||||
// #ifdef H5
|
||||
this.getChatUrL();
|
||||
// 获取H5 搜索框高度
|
||||
let appSearchH = uni.createSelectorQuery().select(".serch-wrapper");
|
||||
appSearchH.boundingClientRect(function(data) {
|
||||
|
|
|
@ -45,14 +45,16 @@
|
|||
<view class="title">核销信息</view>
|
||||
<view class="grayBg">
|
||||
<view class="pictrue">
|
||||
<image :src="orderInfo.code"></image>
|
||||
<!-- <div class="qrcode" ref="qrcode"></div> -->
|
||||
<!-- <canvas canvas-id="qrcode" :style="{width: `${qrcodeSize}100%`, height: `${qrcodeSize}100%`}"/> -->
|
||||
<image :src="codeImg"></image>
|
||||
</view>
|
||||
</view>
|
||||
<view class="gear">
|
||||
<image src="../../static/images/writeOff.jpg"></image>
|
||||
</view>
|
||||
<view class="num">{{orderInfo.verifyCode}}</view>
|
||||
<view class="rules">
|
||||
<view class="rules" v-if='orderInfo.systemStore'>
|
||||
<view class="item">
|
||||
<view class="rulesTitle acea-row row-middle">
|
||||
<text class="iconfont icon-shijian"></text>核销时间
|
||||
|
@ -589,7 +591,8 @@
|
|||
orderAgain,
|
||||
orderTake,
|
||||
orderDel,
|
||||
orderCancel
|
||||
orderCancel,
|
||||
qrcodeApi
|
||||
} from '@/api/order.js';
|
||||
import {
|
||||
openOrderRefundSubscribe
|
||||
|
@ -609,6 +612,7 @@
|
|||
} from "vuex";
|
||||
// #ifdef MP
|
||||
import authorize from '@/components/Authorize';
|
||||
import uQRCode from '@/js_sdk/Sansnn-uQRCode/uqrcode.js'
|
||||
// #endif
|
||||
export default {
|
||||
components: {
|
||||
|
@ -621,6 +625,8 @@
|
|||
},
|
||||
data() {
|
||||
return {
|
||||
codeImg: '',
|
||||
qrcodeSize: 100,
|
||||
order_id: '',
|
||||
evaluate: 0,
|
||||
cartInfo: [], //购物车产品
|
||||
|
@ -655,7 +661,7 @@
|
|||
uniId:''
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin']),
|
||||
computed: mapGetters(['isLogin', 'chatUrl']),
|
||||
onLoad: function(options) {
|
||||
if (!options.order_id && !options.uniId) return this.$util.Tips({title:'缺少参数'},{tab:3,url:1});
|
||||
this.$set(this, 'order_id', options.order_id);
|
||||
|
@ -691,9 +697,7 @@
|
|||
},
|
||||
methods: {
|
||||
kefuClick(){
|
||||
return this.$util.Tips({
|
||||
title: '客服功能正在开发中......'
|
||||
});
|
||||
location.href = this.chatUrl;
|
||||
},
|
||||
goGoodCall() {
|
||||
let self = this
|
||||
|
@ -829,6 +833,7 @@
|
|||
that.isGoodsReturn = true;
|
||||
};
|
||||
that.getOrderStatus();
|
||||
that.markCode(res.data.verifyCode);
|
||||
}).catch(err => {
|
||||
uni.hideLoading();
|
||||
that.$util.Tips({
|
||||
|
@ -836,6 +841,15 @@
|
|||
}, '/pages/users/order_list/index');
|
||||
});
|
||||
},
|
||||
/**
|
||||
*
|
||||
* 生成二维码
|
||||
*/
|
||||
markCode(text) {
|
||||
qrcodeApi({ height: '145', text: text, width: '145' }).then(res => {
|
||||
this.codeImg = res.data.code
|
||||
});
|
||||
},
|
||||
/**
|
||||
*
|
||||
* 剪切订单号
|
||||
|
@ -899,7 +913,7 @@
|
|||
let that = this;
|
||||
orderAgain(that.orderInfo.unique).then(res => {
|
||||
return uni.navigateTo({
|
||||
url: '/pages/users/order_confirm/index?cartId=' + res.data.cateId + '&again=true&new=true'
|
||||
url: '/pages/users/order_confirm/index?cartId=' + res.data.cateId + '&again=true&new=true&addAgain=true'
|
||||
});
|
||||
});
|
||||
},
|
||||
|
|
|
@ -190,7 +190,8 @@
|
|||
isShowAuth: false, //是否隐藏授权
|
||||
orderStatusNum: {},
|
||||
userInfo: {},
|
||||
MyMenus: []
|
||||
MyMenus: [],
|
||||
wechatUrl: []
|
||||
}
|
||||
},
|
||||
onLoad() {
|
||||
|
@ -220,9 +221,10 @@
|
|||
// }).then(res=>{})
|
||||
// },
|
||||
kefuClick(){
|
||||
return this.$util.Tips({
|
||||
title: '客服功能正在开发中......'
|
||||
});
|
||||
location.href = this.wechatUrl[0].wap_url
|
||||
// return this.$util.Tips({
|
||||
// title: '客服功能正在开发中......'
|
||||
// });
|
||||
},
|
||||
getOrderData(){
|
||||
let that = this;
|
||||
|
@ -297,6 +299,14 @@
|
|||
if (this.MyMenus.length) return;
|
||||
getMenuList().then(res => {
|
||||
that.$set(that, 'MyMenus', res.data.routine_my_menus);
|
||||
// location.pathname.indexOf('auth') !== -1
|
||||
// console.log( res.data.routine_my_menus.filter( item => {
|
||||
// if( item.url.indexOf('service') !== -1 ) return item.wap_url
|
||||
// }))
|
||||
this.wechatUrl = res.data.routine_my_menus.filter((item) => {
|
||||
return item.url.indexOf('service') !== -1
|
||||
})
|
||||
console.log(this.wechatUrl)
|
||||
this.imgUrls = res.data.routine_my_banner
|
||||
});
|
||||
},
|
||||
|
|
|
@ -0,0 +1,372 @@
|
|||
<template>
|
||||
<div class="register absolute">
|
||||
<div class="shading">
|
||||
<div class="pictrue acea-row row-center-wrapper">
|
||||
<image :src="logoUrl" v-if="logoUrl" />
|
||||
<image src="/static/images/logo2.png" v-else />
|
||||
</div>
|
||||
</div>
|
||||
<div class="whiteBg" v-if="formItem === 1">
|
||||
<div class="title acea-row row-center-wrapper">
|
||||
<div class="item" :class="current === index ? 'on' : ''" v-for="(item, index) in navList" @click="navTap(index)"
|
||||
:key="index">
|
||||
{{ item }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="list" :hidden="current !== 1">
|
||||
<form @submit.prevent="submit">
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/phone_1.png"></image>
|
||||
<input type="text" placeholder="输入手机号码" v-model="account" required />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="password" placeholder="填写登录密码" v-model="password" required />
|
||||
</div>
|
||||
</div>
|
||||
</form>
|
||||
<!-- <navigator class="forgetPwd" hover-class="none" url="/pages/users/retrievePassword/index">
|
||||
<span class="iconfont icon-wenti"></span>忘记密码
|
||||
</navigator> -->
|
||||
</div>
|
||||
<div class="list" :hidden="current !== 0">
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/phone_1.png"></image>
|
||||
<input type="text" placeholder="输入手机号码" v-model="account" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
|
||||
{{ text }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" v-if="isShowCode">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
|
||||
<div class="code" @click="again"><img :src="codeUrl" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="logon" @click="loginMobile" :hidden="current !== 0">登录</div>
|
||||
<div class="logon" @click="submit" :hidden="current === 0">登录</div>
|
||||
<div class="tip">
|
||||
<div :hidden="current !== 1">
|
||||
没有账号?
|
||||
<span @click="current = 0" class="font-color-red">快速登录</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<!-- <div class="whiteBg" v-else>
|
||||
<div class="title">注册账号</div>
|
||||
<div class="list">
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/phone_1.png"></image>
|
||||
<input type="text" placeholder="输入手机号码" v-model="account" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="captcha" />
|
||||
<button class="code" :disabled="disabled" :class="disabled === true ? 'on' : ''" @click="code">
|
||||
{{ text }}
|
||||
</button>
|
||||
</div>
|
||||
</div>
|
||||
<div class="item">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_1.png"></image>
|
||||
<input type="password" placeholder="填写您的登录密码" v-model="password" />
|
||||
</div>
|
||||
</div>
|
||||
<div class="item" v-if="isShowCode">
|
||||
<div class="acea-row row-middle">
|
||||
<image src="/static/images/code_2.png"></image>
|
||||
<input type="text" placeholder="填写验证码" class="codeIput" v-model="codeVal" />
|
||||
<div class="code" @click="again"><img :src="codeUrl" /></div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="logon" @click="register">注册</div>
|
||||
<div class="tip">
|
||||
已有账号?
|
||||
<span @click="formItem = 1" class="font-color-red">立即登录</span>
|
||||
</div>
|
||||
</div> -->
|
||||
<div class="bottom"></div>
|
||||
</div>
|
||||
</template>
|
||||
<script>
|
||||
import dayjs from "@/plugin/dayjs/dayjs.min.js";
|
||||
import sendVerifyCode from "@/mixins/SendVerifyCode";
|
||||
import {
|
||||
loginH5,
|
||||
loginMobile,
|
||||
registerVerify,
|
||||
register,
|
||||
// getCodeApi,
|
||||
getUserInfo
|
||||
} from "@/api/user";
|
||||
import attrs, {
|
||||
required,
|
||||
alpha_num,
|
||||
chs_phone
|
||||
} from "@/utils/validate";
|
||||
import {
|
||||
validatorDefaultCatch
|
||||
} from "@/utils/dialog";
|
||||
import {
|
||||
getLogo
|
||||
} from "@/api/public";
|
||||
import {
|
||||
VUE_APP_API_URL
|
||||
} from "@/utils";
|
||||
|
||||
const BACK_URL = "login_back_url";
|
||||
|
||||
export default {
|
||||
name: "Login",
|
||||
mixins: [sendVerifyCode],
|
||||
data: function() {
|
||||
return {
|
||||
navList: ["快速登录", "账号登录"],
|
||||
current: 0,
|
||||
account: "",
|
||||
password: "",
|
||||
captcha: "",
|
||||
formItem: 1,
|
||||
type: "login",
|
||||
logoUrl: "",
|
||||
keyCode: "",
|
||||
codeUrl: "",
|
||||
codeVal: "",
|
||||
isShowCode: false
|
||||
};
|
||||
},
|
||||
watch:{
|
||||
formItem:function(nval,oVal){
|
||||
if(nval == 1){
|
||||
this.type = 'login'
|
||||
}else{
|
||||
this.type = 'register'
|
||||
}
|
||||
}
|
||||
},
|
||||
mounted: function() {
|
||||
this.getCode();
|
||||
this.getLogoImage();
|
||||
},
|
||||
methods: {
|
||||
again() {
|
||||
this.codeUrl =
|
||||
VUE_APP_API_URL +
|
||||
"/sms_captcha?" +
|
||||
"key=" +
|
||||
this.keyCode +
|
||||
Date.parse(new Date());
|
||||
},
|
||||
getCode() {
|
||||
let that = this
|
||||
// getCodeApi()
|
||||
// .then(res => {
|
||||
// that.keyCode = res.data.key;
|
||||
// })
|
||||
// .catch(res => {
|
||||
// that.$util.Tips({
|
||||
// title: res
|
||||
// });
|
||||
// });
|
||||
},
|
||||
async getLogoImage() {
|
||||
let that = this;
|
||||
getLogo().then(res => {
|
||||
that.logoUrl = res.data.logoUrl;
|
||||
});
|
||||
},
|
||||
async loginMobile() {
|
||||
let that = this;
|
||||
if (!that.account) return that.$util.Tips({
|
||||
title: '请填写手机号码'
|
||||
});
|
||||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
|
||||
title: '请输入正确的手机号码'
|
||||
});
|
||||
if (!that.captcha) return that.$util.Tips({
|
||||
title: '请填写验证码'
|
||||
});
|
||||
if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
|
||||
title: '请输入正确的验证码'
|
||||
});
|
||||
loginMobile({
|
||||
account: that.account,
|
||||
captcha: that.captcha,
|
||||
spread: that.$Cache.get("spread")
|
||||
})
|
||||
.then(res => {
|
||||
let data = res.data;
|
||||
let newTime = Math.round(new Date() / 1000);
|
||||
that.$store.commit("LOGIN", {
|
||||
'token': data.token
|
||||
// 'time': dayjs(data.expiresTime) - newTime
|
||||
});
|
||||
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
|
||||
that.$Cache.clear(BACK_URL);
|
||||
// getUserInfo().then(res => {
|
||||
that.$store.commit("SETUID", res.data.user.uid);
|
||||
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ===
|
||||
'/pages/user/index') {
|
||||
|
||||
uni.switchTab({
|
||||
url: backUrl
|
||||
});
|
||||
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
// })
|
||||
})
|
||||
.catch(res => {
|
||||
that.$util.Tips({
|
||||
title: res
|
||||
});
|
||||
});
|
||||
},
|
||||
async register() {
|
||||
let that = this;
|
||||
if (!that.account) return that.$util.Tips({
|
||||
title: '请填写手机号码'
|
||||
});
|
||||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
|
||||
title: '请输入正确的手机号码'
|
||||
});
|
||||
if (!that.captcha) return that.$util.Tips({
|
||||
title: '请填写验证码'
|
||||
});
|
||||
if (!/^[\w\d]+$/i.test(that.captcha)) return that.$util.Tips({
|
||||
title: '请输入正确的验证码'
|
||||
});
|
||||
if (!that.password) return that.$util.Tips({
|
||||
title: '请填写密码'
|
||||
});
|
||||
if (!/^(?![0-9]+$)(?![a-zA-Z]+$)[0-9A-Za-z]{6,16}$/i.test(that.password)) return that.$util.Tips({
|
||||
title: '您输入的密码过于简单'
|
||||
});
|
||||
register({
|
||||
account: that.account,
|
||||
captcha: that.captcha,
|
||||
password: that.password,
|
||||
spread: that.$Cache.get("spread")
|
||||
})
|
||||
.then(res => {
|
||||
that.$util.Tips({
|
||||
title: res
|
||||
});
|
||||
that.formItem = 1;
|
||||
})
|
||||
.catch(res => {
|
||||
that.$util.Tips({
|
||||
title: res
|
||||
});
|
||||
});
|
||||
},
|
||||
async code() {
|
||||
let that = this;
|
||||
if (!that.account) return that.$util.Tips({
|
||||
title: '请填写手机号码'
|
||||
});
|
||||
if (!/^1(3|4|5|7|8|9|6)\d{9}$/i.test(that.account)) return that.$util.Tips({
|
||||
title: '请输入正确的手机号码'
|
||||
});
|
||||
if (that.formItem == 2) that.type = "register";
|
||||
// phone: that.account
|
||||
// type: that.type,
|
||||
// key: that.keyCode,
|
||||
// code: that.codeVal
|
||||
await registerVerify(that.account)
|
||||
.then(res => {
|
||||
that.$util.Tips({title:res.message});
|
||||
that.sendCode();
|
||||
})
|
||||
.catch(res => {
|
||||
// if (res.data.status === 402) {
|
||||
// that.codeUrl = `${VUE_APP_API_URL}/sms_captcha?key=${that.keyCode}`;
|
||||
// that.isShowCode = true;
|
||||
// }
|
||||
that.$util.Tips({title:res.message});
|
||||
});
|
||||
},
|
||||
navTap: function(index) {
|
||||
this.current = index;
|
||||
},
|
||||
async submit() {
|
||||
let that = this;
|
||||
if (!that.account) return that.$util.Tips({
|
||||
title: '请填写账号'
|
||||
});
|
||||
if (!/^[\w\d]{5,16}$/i.test(that.account)) return that.$util.Tips({
|
||||
title: '请输入正确的账号'
|
||||
});
|
||||
if (!that.password) return that.$util.Tips({
|
||||
title: '请填写密码'
|
||||
});
|
||||
loginH5({
|
||||
account: that.account,
|
||||
password: that.password,
|
||||
spread: that.$Cache.get("spread")
|
||||
})
|
||||
.then(({
|
||||
data
|
||||
}) => {
|
||||
// let newTime = Math.round(new Date() / 1000);
|
||||
that.$store.commit("LOGIN", {
|
||||
'token': data.token
|
||||
// 'time': dayjs(data.expiresTime) - newTime
|
||||
});
|
||||
const backUrl = that.$Cache.get(BACK_URL) || "/pages/index/index";
|
||||
that.$Cache.clear(BACK_URL);
|
||||
getUserInfo().then(res => {
|
||||
that.$store.commit("SETUID", res.data.uid);
|
||||
if (backUrl === '/pages/index/index' || backUrl === '/pages/order_addcart/order_addcart' || backUrl ==='/pages/user/index') {
|
||||
uni.switchTab({
|
||||
url: backUrl
|
||||
});
|
||||
} else {
|
||||
uni.switchTab({
|
||||
url: '/pages/index/index'
|
||||
});
|
||||
}
|
||||
})
|
||||
})
|
||||
.catch(e => {
|
||||
that.$util.Tips({
|
||||
title: e
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
};
|
||||
</script>
|
||||
<style lang="scss">
|
||||
.code img {
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
.acea-row.row-middle {
|
||||
input {
|
||||
margin-left: 20rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
|
@ -270,7 +270,8 @@
|
|||
isShowAuth: false, //是否隐藏授权
|
||||
from: '',
|
||||
news: true,
|
||||
again: false
|
||||
again: false,
|
||||
addAgain: false
|
||||
};
|
||||
},
|
||||
computed: mapGetters(['isLogin']),
|
||||
|
@ -294,6 +295,7 @@
|
|||
this.is_address = options.is_address ? true : false;
|
||||
this.news = options.new || true;
|
||||
this.again = options.again || false;
|
||||
this.addAgain = options.addAgain || false;
|
||||
if (this.isLogin) {
|
||||
this.getaddressInfo();
|
||||
this.getConfirm();
|
||||
|
@ -361,8 +363,8 @@
|
|||
* 获取门店列表数据
|
||||
*/
|
||||
getList: function() {
|
||||
let longitude = uni.getStorageSync("CACHE_LONGITUDE"); //经度
|
||||
let latitude = uni.getStorageSync("CACHE_LATITUDE"); //纬度
|
||||
let longitude = uni.getStorageSync("user_longitude"); //经度
|
||||
let latitude = uni.getStorageSync("user_latitude"); //纬度
|
||||
let data = {
|
||||
latitude: latitude, //纬度
|
||||
longitude: longitude, //经度
|
||||
|
@ -400,6 +402,7 @@
|
|||
shippingType: parseInt(shippingType) + 1,
|
||||
payType: this.payType
|
||||
}).then(res => {
|
||||
console.log(res)
|
||||
let result = res.data.result.result;
|
||||
if (result) {
|
||||
this.totalPrice = result.orderId.payPrice;
|
||||
|
@ -408,7 +411,11 @@
|
|||
this.integral = this.useIntegral ? result.orderId.surplusIntegral : this.userInfo.integral;
|
||||
this.$set(this.priceGroup, 'storePostage', shippingType == 1 ? 0 : result.orderId.payPostage);
|
||||
}
|
||||
})
|
||||
}).catch(err => {
|
||||
return this.$util.Tips({
|
||||
title: err
|
||||
});
|
||||
});
|
||||
},
|
||||
addressType: function(e) {
|
||||
let index = e;
|
||||
|
@ -494,7 +501,7 @@
|
|||
*/
|
||||
getConfirm: function() {
|
||||
let that = this;
|
||||
orderConfirm(that.cartId,that.again).then(res => {
|
||||
orderConfirm(that.cartId,that.news,this.addAgain).then(res => {
|
||||
that.$set(that, 'userInfo', res.data.userInfo);
|
||||
that.$set(that, 'integral', res.data.userInfo.integral);
|
||||
that.$set(that, 'cartInfo', res.data.cartInfo);
|
||||
|
@ -570,17 +577,21 @@
|
|||
let that = this;
|
||||
if (that.addressId) {
|
||||
getAddressDetail(that.addressId).then(res => {
|
||||
res.data.isDefault = parseInt(res.data.isDefault);
|
||||
that.addressInfo = res.data || {};
|
||||
that.addressId = res.data.id || 0;
|
||||
that.address.addressId = res.data.id || 0;
|
||||
if(res.data){
|
||||
res.data.isDefault = parseInt(res.data.isDefault);
|
||||
that.addressInfo = res.data || {};
|
||||
that.addressId = res.data.id || 0;
|
||||
that.address.addressId = res.data.id || 0;
|
||||
}
|
||||
})
|
||||
} else {
|
||||
getAddressDefault().then(res => {
|
||||
res.data.isDefault = parseInt(res.data.isDefault);
|
||||
that.addressInfo = res.data || {};
|
||||
that.addressId = res.data.id || 0;
|
||||
that.address.addressId = res.data.id || 0;
|
||||
if(res.data){
|
||||
res.data.isDefault = parseInt(res.data.isDefault);
|
||||
that.addressInfo = res.data || {};
|
||||
that.addressId = res.data.id || 0;
|
||||
that.address.addressId = res.data.id || 0;
|
||||
}
|
||||
})
|
||||
}
|
||||
},
|
||||
|
@ -820,8 +831,6 @@
|
|||
title: '暂无门店,请选择其他方式'
|
||||
});
|
||||
}
|
||||
console.log('坎坎坷坷扩');
|
||||
console.log(that.news);
|
||||
data = {
|
||||
realName: that.contacts,
|
||||
phone: that.contactsTel,
|
||||
|
|
|
@ -108,8 +108,8 @@
|
|||
that.$set(that,'couponsList',list);
|
||||
that.$util.Tips({ title: '领取成功' });
|
||||
},function(res){
|
||||
return that.$util.Tips({title:res.msg});
|
||||
});
|
||||
return that.$util.Tips({title:res});
|
||||
})
|
||||
},
|
||||
/**
|
||||
* 获取领取优惠券列表
|
||||
|
|
|
@ -0,0 +1,373 @@
|
|||
<template>
|
||||
<view>
|
||||
<view class="system-height" :style="{height:statusBarHeight}"></view>
|
||||
<!-- #ifdef MP -->
|
||||
<view class="title-bar" style="height: 43px;">
|
||||
<view class="icon" @click="back" v-if="!isHome"><image src="../static/left.png" ></image></view>
|
||||
<view class="icon" @click="home" v-else><image src="../static/home.png"></image></view>
|
||||
账户登录
|
||||
</view>
|
||||
<!-- #endif -->
|
||||
<view class="wechat_login">
|
||||
<view class="img">
|
||||
<image src="../static/wechat_login.png" mode="widthFix"></image>
|
||||
</view>
|
||||
<view class="btn-wrapper">
|
||||
<button class="bg-red" hover-class="none" @click="isUp=true">手机号登录(账户同步)</button>
|
||||
<!-- #ifdef H5 -->
|
||||
<button hover-class="none" @click="wechatLogin">微信一键登录</button>
|
||||
<!-- #endif -->
|
||||
<!-- #ifdef MP -->
|
||||
<button hover-class="none" open-type="getUserInfo" @getuserinfo="setUserInfo">微信一键登录</button>
|
||||
<!-- #endif -->
|
||||
</view>
|
||||
</view>
|
||||
<block v-if="isUp">
|
||||
<mobileLogin :isUp="isUp" @close="maskClose" :authKey="authKey" @wechatPhone="wechatPhone"></mobileLogin>
|
||||
</block>
|
||||
<block v-if="isPhoneBox">
|
||||
<routinePhone :logoUrl="logoUrl" :isPhoneBox="isPhoneBox" @close="bindPhoneClose" :authKey="authKey"></routinePhone>
|
||||
</block>
|
||||
</view>
|
||||
</template>
|
||||
|
||||
<script>
|
||||
const app = getApp();
|
||||
let statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px';
|
||||
import mobileLogin from '@/components/login_mobile/index.vue'
|
||||
import routinePhone from '@/components/login_mobile/routine_phone.vue'
|
||||
import {
|
||||
getLogo,
|
||||
silenceAuth,
|
||||
getUserPhone,
|
||||
wechatAuthV2
|
||||
} from '@/api/public';
|
||||
import {
|
||||
LOGO_URL,
|
||||
EXPIRES_TIME,
|
||||
USER_INFO,
|
||||
STATE_R_KEY
|
||||
} from '@/config/cache';
|
||||
import {
|
||||
getUserInfo
|
||||
} from '@/api/user.js'
|
||||
import Routine from '@/libs/routine';
|
||||
import wechat from "@/libs/wechat";
|
||||
export default {
|
||||
data() {
|
||||
return {
|
||||
isUp:false,
|
||||
phone: '',
|
||||
statusBarHeight: statusBarHeight,
|
||||
isHome:false,
|
||||
isPhoneBox:false,
|
||||
logoUrl:'',
|
||||
code:'',
|
||||
authKey:'',
|
||||
options:'',
|
||||
userInfo:{},
|
||||
codeNum:0
|
||||
}
|
||||
},
|
||||
components:{
|
||||
mobileLogin,
|
||||
routinePhone
|
||||
},
|
||||
onLoad(options) {
|
||||
getLogo().then(res=>{
|
||||
this.logoUrl = res.data.logo_url
|
||||
})
|
||||
let that = this
|
||||
// #ifdef H5
|
||||
document.body.addEventListener("focusout", () => {
|
||||
setTimeout(() => {
|
||||
const scrollHeight = document.documentElement.scrollTop || document.body.scrollTop || 0;
|
||||
window.scrollTo(0, Math.max(scrollHeight - 1, 0));
|
||||
}, 100);
|
||||
});
|
||||
const {
|
||||
code,
|
||||
state,
|
||||
scope
|
||||
} = options;
|
||||
this.options = options
|
||||
// 获取确认授权code
|
||||
this.code = code || ''
|
||||
if(code){
|
||||
let spread = app.globalData.spid ? app.globalData.spid : '';
|
||||
//公众号授权登录回调
|
||||
wechat.auth(code, state).then(res => {
|
||||
if (res.key !== undefined && res.key) {
|
||||
that.authKey = res.key;
|
||||
that.isUp = true
|
||||
}else{
|
||||
let time = res.expires_time - that.$Cache.time();
|
||||
that.$store.commit('LOGIN', {
|
||||
token: res.token,
|
||||
time: time
|
||||
});
|
||||
that.userInfo = res.userInfo
|
||||
that.$store.commit("SETUID", res.userInfo.uid);
|
||||
that.$store.commit("UPDATE_USERINFO", res.userInfo);
|
||||
that.wechatPhone()
|
||||
}
|
||||
}).catch(error => {
|
||||
// location.replace("/");
|
||||
});
|
||||
}
|
||||
// #endif
|
||||
let pages = getCurrentPages();
|
||||
let prePage = pages[pages.length - 2];
|
||||
if(prePage.route == 'pages/order_addcart/order_addcart'){
|
||||
this.isHome = true
|
||||
}else{
|
||||
this.isHome = false
|
||||
}
|
||||
|
||||
},
|
||||
methods: {
|
||||
back(){
|
||||
uni.navigateBack();
|
||||
},
|
||||
home(){
|
||||
uni.switchTab({
|
||||
url:'/pages/index/index'
|
||||
})
|
||||
},
|
||||
// 弹窗关闭
|
||||
maskClose(){
|
||||
this.isUp = false
|
||||
},
|
||||
bindPhoneClose(data){
|
||||
if(data.isStatus){
|
||||
this.isPhoneBox = false
|
||||
this.$util.Tips({
|
||||
title:'登录成功',
|
||||
icon:'success'
|
||||
},{
|
||||
tab:3
|
||||
})
|
||||
}else{
|
||||
this.isPhoneBox = false
|
||||
}
|
||||
|
||||
},
|
||||
// #ifdef MP
|
||||
// 小程序获取手机号码
|
||||
getphonenumber(e) {
|
||||
uni.showLoading({
|
||||
title: '正在登录中'
|
||||
});
|
||||
Routine.getCode()
|
||||
.then(code => {
|
||||
this.getUserPhoneNumber(e.detail.encryptedData, e.detail.iv, code);
|
||||
})
|
||||
.catch(error => {
|
||||
uni.$emit('closePage', false)
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
// 小程序获取手机号码回调
|
||||
getUserPhoneNumber(encryptedData, iv, code) {
|
||||
getUserPhone({
|
||||
encryptedData: encryptedData,
|
||||
iv: iv,
|
||||
code: code,
|
||||
spid: app.globalData.spid,
|
||||
spread: app.globalData.code
|
||||
})
|
||||
.then(res => {
|
||||
let time = res.data.expires_time - this.$Cache.time();
|
||||
this.$store.commit('LOGIN', {
|
||||
token: res.data.token,
|
||||
time: time
|
||||
});
|
||||
this.userInfo = res.data.userInfo
|
||||
this.$store.commit("SETUID", res.data.userInfo.uid);
|
||||
this.$store.commit("UPDATE_USERINFO", res.data.userInfo);
|
||||
this.$util.Tips({
|
||||
title: '登录成功',
|
||||
icon: 'success'
|
||||
}, {
|
||||
tab: 3
|
||||
})
|
||||
|
||||
})
|
||||
.catch(res => {
|
||||
console.log(res);
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
/**
|
||||
* 获取个人用户信息
|
||||
*/
|
||||
getUserInfo: function() {
|
||||
let that = this;
|
||||
getUserInfo().then(res => {
|
||||
uni.hideLoading();
|
||||
that.userInfo = res.data
|
||||
that.$store.commit("SETUID", res.data.uid);
|
||||
that.$store.commit("UPDATE_USERINFO", res.data);
|
||||
that.$util.Tips({
|
||||
title: '登录成功',
|
||||
icon: 'success'
|
||||
}, {
|
||||
tab: 3
|
||||
})
|
||||
});
|
||||
},
|
||||
setUserInfo(e) {
|
||||
uni.showLoading({ title: '正在登录中' });
|
||||
Routine.getCode()
|
||||
.then(code => {
|
||||
this.getWxUser(code);
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
getWxUser(code){
|
||||
let self = this
|
||||
Routine.getUserInfo()
|
||||
.then(res => {
|
||||
let userInfo = res.userInfo;
|
||||
userInfo.code = code;
|
||||
userInfo.spread_spid = app.globalData.spid; //获取推广人ID
|
||||
userInfo.spread_code = app.globalData.code; //获取推广人分享二维码ID
|
||||
Routine.authUserInfo(userInfo)
|
||||
.then(res => {
|
||||
if(res.data.key !== undefined && res.data.key){
|
||||
uni.hideLoading();
|
||||
self.authKey = res.data.key;
|
||||
self.isPhoneBox = true
|
||||
}else{
|
||||
uni.hideLoading();
|
||||
let time = res.data.expires_time - self.$Cache.time();
|
||||
self.$store.commit('LOGIN', {
|
||||
token: res.data.token,
|
||||
time: time
|
||||
});
|
||||
self.$util.Tips({
|
||||
title:res.msg,
|
||||
icon:'success'
|
||||
},{
|
||||
tab:3
|
||||
})
|
||||
}
|
||||
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
uni.showToast({
|
||||
title: res.msg,
|
||||
icon: 'none',
|
||||
duration: 2000
|
||||
});
|
||||
});
|
||||
})
|
||||
.catch(res => {
|
||||
uni.hideLoading();
|
||||
});
|
||||
},
|
||||
|
||||
|
||||
// #endif
|
||||
// #ifdef H5
|
||||
// 获取url后面的参数
|
||||
getQueryString(name) {
|
||||
var reg = new RegExp("(^|&)" + name + "=([^&]*)(&|$)", "i");
|
||||
var reg_rewrite = new RegExp("(^|/)" + name + "/([^/]*)(/|$)", "i");
|
||||
var r = window.location.search.substr(1).match(reg);
|
||||
var q = window.location.pathname.substr(1).match(reg_rewrite);
|
||||
if(r != null){
|
||||
return unescape(r[2]);
|
||||
}else if(q != null){
|
||||
return unescape(q[2]);
|
||||
}else{
|
||||
return null;
|
||||
}
|
||||
},
|
||||
// 公众号登录
|
||||
wechatLogin(){
|
||||
if(!this.code){
|
||||
this.$wechat.oAuth('','/pages/users/wechat_login/index')
|
||||
}else{
|
||||
}
|
||||
},
|
||||
// 输入手机号后的回调
|
||||
wechatPhone(){
|
||||
if(this.options.back_url){
|
||||
let url = uni.getStorageSync('snRouter')
|
||||
let self = this
|
||||
this.isUp = false
|
||||
uni.showToast({
|
||||
title:'登录成功',
|
||||
icon:'none'
|
||||
})
|
||||
setTimeout(res=>{
|
||||
location.href = url.indexOf("/pages/index/index") != -1?'/':url
|
||||
},800)
|
||||
}else{
|
||||
uni.navigateBack()
|
||||
}
|
||||
}
|
||||
// #endif
|
||||
}
|
||||
}
|
||||
</script>
|
||||
|
||||
<style lang="scss" scoped>
|
||||
page {
|
||||
background: #fff;
|
||||
}
|
||||
|
||||
.wechat_login {
|
||||
padding: 72rpx 34rpx;
|
||||
|
||||
.img image {
|
||||
width: 100%;
|
||||
}
|
||||
|
||||
.btn-wrapper {
|
||||
margin-top: 86rpx;
|
||||
|
||||
button {
|
||||
width: 100%;
|
||||
height: 86rpx;
|
||||
line-height: 86rpx;
|
||||
margin-bottom: 40rpx;
|
||||
color: $theme-color;
|
||||
border: 1px solid $theme-color;
|
||||
border-radius: 120rpx;
|
||||
font-size: 30rpx;
|
||||
|
||||
&.bg-red {
|
||||
background: $theme-color;
|
||||
color: #fff;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
.title-bar {
|
||||
position: relative;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
font-size: 36rpx;
|
||||
}
|
||||
.icon{
|
||||
position: absolute;
|
||||
left: 30rpx;
|
||||
top: 0;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
justify-content: center;
|
||||
width: 86rpx;
|
||||
height: 86rpx;
|
||||
image{
|
||||
width: 50rpx;
|
||||
height: 50rpx;
|
||||
}
|
||||
}
|
||||
</style>
|
File diff suppressed because one or more lines are too long
|
@ -6,6 +6,7 @@ export default {
|
|||
uid:state => state.app.uid,
|
||||
homeActive: state => state.app.homeActive,
|
||||
home: state => state.app.home,
|
||||
chatUrl: state => state.app.chatUrl
|
||||
};
|
||||
// export default {
|
||||
// token: state => 'eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiJ9.eyJpc3MiOiJrYWlmYS5jcm1lYi5uZXQiLCJhdWQiOiJrYWlmYS5jcm1lYi5uZXQiLCJpYXQiOjE1NzcwODM1MzQsIm5iZiI6MTU3NzA4MzUzNCwiZXhwIjoxNTc3MDk0MzM0LCJqdGkiOnsiaWQiOjExMCwidHlwZSI6InVzZXIifX0.U-i1pbdRjyXI1gr79Uq2XBPZ89T8f5Ai9jwrR8woTwE',
|
||||
|
|
|
@ -16,6 +16,7 @@ const state = {
|
|||
userInfo: null,
|
||||
uid: Cache.get(UID) || null,
|
||||
homeActive: false,
|
||||
chatUrl: Cache.get('chatUrl') || '',
|
||||
};
|
||||
|
||||
const mutations = {
|
||||
|
@ -49,6 +50,9 @@ const mutations = {
|
|||
CLOSE_HOME(state) {
|
||||
state.homeActive = false;
|
||||
},
|
||||
SET_CHATURL(state, chatUrl){
|
||||
state.chatUrl = chatUrl;
|
||||
}
|
||||
};
|
||||
|
||||
const actions = {
|
||||
|
|
|
@ -1,25 +1,22 @@
|
|||
import {
|
||||
SUBSCRIBE_MESSAGE
|
||||
} from '../config/cache.js';
|
||||
// import {
|
||||
// SUBSCRIBE_MESSAGE
|
||||
// } from '../config/cache.js';
|
||||
const arrTemp = ["paySubscribe","orderSubscribe","extrctSubscribe", "orderRefundSubscribe", "rechargeSubscribe"];
|
||||
|
||||
export function auth() {
|
||||
let tmplIds = {};
|
||||
let messageTmplIds = uni.getStorageSync(SUBSCRIBE_MESSAGE);
|
||||
tmplIds = messageTmplIds ? JSON.parse(messageTmplIds) : {};
|
||||
return tmplIds;
|
||||
}
|
||||
// export function auth() {
|
||||
// let tmplIds = {};
|
||||
// let messageTmplIds = uni.getStorageSync(SUBSCRIBE_MESSAGE);
|
||||
// tmplIds = messageTmplIds ? JSON.parse(messageTmplIds) : {};
|
||||
// return tmplIds;
|
||||
// }
|
||||
|
||||
/**
|
||||
* 支付成功后订阅消息id
|
||||
* 订阅 确认收货通知 订单支付成功 新订单管理员提醒
|
||||
*/
|
||||
export function openPaySubscribe() {
|
||||
let tmplIds = auth();
|
||||
return subscribe([
|
||||
tmplIds.oreder_takever,
|
||||
tmplIds.order_pay_success,
|
||||
tmplIds.order_new,
|
||||
]);
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[0]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -27,12 +24,8 @@ export function openPaySubscribe() {
|
|||
* 送货 发货 取消订单
|
||||
*/
|
||||
export function openOrderSubscribe() {
|
||||
let tmplIds = auth();
|
||||
return subscribe([
|
||||
tmplIds.order_deliver_success,
|
||||
tmplIds.order_postage_success,
|
||||
tmplIds.order_clone
|
||||
]);
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[1]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -40,10 +33,8 @@ export function openOrderSubscribe() {
|
|||
* 成功 和 失败 消息
|
||||
*/
|
||||
export function openExtrctSubscribe() {
|
||||
let tmplIds = auth();
|
||||
return subscribe([
|
||||
tmplIds.user_extract
|
||||
]);
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[2]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -70,25 +61,25 @@ export function openBargainSubscribe() {
|
|||
* 订单退款
|
||||
*/
|
||||
export function openOrderRefundSubscribe() {
|
||||
let tmplIds = auth();
|
||||
return subscribe([tmplIds.order_refund]);
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[3]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 充值成功
|
||||
*/
|
||||
export function openRechargeSubscribe() {
|
||||
let tmplIds = auth();
|
||||
return subscribe([tmplIds.recharge_success]);
|
||||
let tmplIds = uni.getStorageSync('tempID' + arrTemp[4]);
|
||||
return subscribe(tmplIds);
|
||||
}
|
||||
|
||||
/**
|
||||
* 提现
|
||||
*/
|
||||
export function openEextractSubscribe() {
|
||||
let tmplIds = auth();
|
||||
return subscribe([tmplIds.user_extract]);
|
||||
}
|
||||
// /**
|
||||
// * 提现
|
||||
// */
|
||||
// export function openEextractSubscribe() {
|
||||
// let tmplIds = JSON.parse(uni.getStorageSync('tempID' + paySubscribe));
|
||||
// return subscribe(tmplIds);
|
||||
// }
|
||||
|
||||
/**
|
||||
* 调起订阅界面
|
||||
|
|
|
@ -2,7 +2,7 @@ import { spread } from "@/api/user";
|
|||
import Cache from "@/utils/cache";
|
||||
|
||||
/**
|
||||
* 绑定用户授权
|
||||
* 静默授权绑定上下级,使用在已经登录后扫描了别人的推广二维码
|
||||
* @param {Object} puid
|
||||
*/
|
||||
export function silenceBindingSpread()
|
||||
|
@ -25,20 +25,21 @@ export function silenceBindingSpread()
|
|||
puid = 0;
|
||||
}
|
||||
if(puid){
|
||||
spread(puid).then(res=>{
|
||||
console.log(res);
|
||||
//#ifdef H5
|
||||
Cache.clear('spread');
|
||||
//#endif
|
||||
|
||||
//#ifdef MP
|
||||
getApp().globalData.spid = 0;
|
||||
getApp().globalData.code = 0;
|
||||
//#endif
|
||||
|
||||
}).catch(res=>{
|
||||
console.log(res);
|
||||
});
|
||||
//#ifdef H5
|
||||
Cache.set('spread', 0);
|
||||
//#endif
|
||||
|
||||
//#ifdef MP
|
||||
getApp().globalData.spid = 0;
|
||||
getApp().globalData.code = 0;
|
||||
//#endif
|
||||
// spread(puid).then(res=>{
|
||||
// console.log(res);
|
||||
// }).catch(res=>{
|
||||
// console.log(res);
|
||||
// });
|
||||
}else{
|
||||
Cache.set('spread', 0);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -27,7 +27,7 @@ function baseRequest(url, method, data, {
|
|||
if (!store.state.app.token && !checkLogin()) {
|
||||
toLogin();
|
||||
return Promise.reject({
|
||||
msg: '未登陆'
|
||||
msg: '未登录'
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue