1、提货点
2、客服(腾讯云智服)
3、接口权限控制
4、复制第三方商品可配置
4、优化附件上传配置
5、手机端核销订单
6、手机端订单统计、订单管理
7、短信优化
8、订阅消息全自动化
pull/1/MERGE
张乐 2020-09-15 16:13:25 +08:00
parent 6685425ae0
commit 8c67e73d43
29 changed files with 1001 additions and 123 deletions

24
.gitignore vendored Normal file
View File

@ -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

View File

@ -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});
}
/**

View File

@ -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);
}

View File

@ -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 });

View File

@ -325,7 +325,7 @@ export function getRechargeApi() {
}
/**
* 记录
* 记录
*/
export function setVisit(data)
{

View File

@ -98,7 +98,7 @@
})
},
setUserInfo(){
uni.showLoading({title:'正在登中'});
uni.showLoading({title:'正在登中'});
Routine.getCode().then(code=>{
this.getUserInfo(code);
}).catch(res=>{

View File

@ -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=>{

View File

@ -96,4 +96,7 @@
line-height: 86rpx;
box-sizing: border-box;
}
.pictrue image{
background: #f4f4f4;
}
</style>

View File

@ -73,6 +73,7 @@
width: 100%;
height: 100%;
border-radius: 50%;
background: #f4f4f4;
}
.evaluateWtapper .evaluateItem .pic-text .name {

View File

@ -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',

View File

@ -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) {

View File

@ -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

View File

@ -68,6 +68,13 @@
"desc" : "你的位置信息将用于和门店的距离长度"
}
},
// "plugins" : {
// "chat" : {
// "version" : "1.0.8",
// "provider" : "wx738958e0f4c894f9"
// }
// },
// "sitemapLocation" : "sitemap.json",
"usingComponents" : true
},
"mp-alipay" : {

View File

@ -109,7 +109,7 @@
// #endif
}
}
],
],
"subPackages": [
{
"root": "pages/users",

View File

@ -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;

View File

@ -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

View File

@ -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) {

View File

@ -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'
});
});
},

View File

@ -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
});
},

View File

@ -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>

View File

@ -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,

View File

@ -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});
})
},
/**
* 获取领取优惠券列表

View File

@ -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>

1
plugin/chat/yzf_chat.js Normal file

File diff suppressed because one or more lines are too long

View File

@ -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',

View File

@ -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 = {

View File

@ -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);
// }
/**
* 调起订阅界面

View File

@ -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);
}
}

View File

@ -27,7 +27,7 @@ function baseRequest(url, method, data, {
if (!store.state.app.token && !checkLogin()) {
toLogin();
return Promise.reject({
msg: '未登'
msg: '未登'
});
}
}