25 changed files with 870 additions and 485 deletions
-
3README.md
-
3package-lock.json
-
6package.json
-
3src/App.vue
-
2src/components/integral_order/integral_order.vue
-
2src/components/membership_order/membership_order.vue
-
4src/components/reservation_order/reservation_order.vue
-
10src/js/api.js
-
8src/js/server.js
-
4src/main.js
-
6src/pages.json
-
156src/pages/admin_bind/admin_bind.vue
-
136src/pages/index/index.vue
-
36src/pages/merchant_info/merchant_info.vue
-
15src/pages/order_list/order_list.vue
-
61src/pages/store_list/store_list.vue
-
13src/pages/write_off/list/list.vue
-
5src/store/actions.js
-
16src/store/index.js
-
10src/store/mutations.js
-
12src/utils/components.js
-
14src/utils/util.js
@ -1,11 +1,13 @@ |
|||||
import Vue from 'vue' |
import Vue from 'vue' |
||||
import App from './App' |
import App from './App' |
||||
|
import store from './store/index.js'; |
||||
|
|
||||
Vue.config.productionTip = false |
Vue.config.productionTip = false |
||||
|
|
||||
App.mpType = 'app' |
App.mpType = 'app' |
||||
|
|
||||
const app = new Vue({ |
const app = new Vue({ |
||||
...App |
|
||||
|
...App, |
||||
|
store |
||||
}) |
}) |
||||
app.$mount() |
app.$mount() |
@ -0,0 +1,156 @@ |
|||||
|
<template> |
||||
|
<view class="admin-bind"> |
||||
|
<image mode="aspectFit" src="/static/images/icon/success_tip.png"></image> |
||||
|
<view class="ab-tip">扫码成功</view> |
||||
|
<view class="ab-brand">品牌名称:{{brandInfo.name || ''}}</view> |
||||
|
<view>请点击“确认绑定”按钮成为超级管理员;</view> |
||||
|
<view>绑定后您将可以添加员工并查看品牌订单数据</view> |
||||
|
<button |
||||
|
plain |
||||
|
hover-class="hover-active" |
||||
|
open-type="getUserInfo" |
||||
|
lang="zh_CN" |
||||
|
@getuserinfo="getuserinfo">确认绑定</button> |
||||
|
</view> |
||||
|
</template> |
||||
|
|
||||
|
<script> |
||||
|
import { API } from '../../js/api'; |
||||
|
import { servers } from '../../js/server'; |
||||
|
import util from '../../utils/util'; |
||||
|
const uniLogin = util.promisify(uni.login); |
||||
|
export default { |
||||
|
data(){ |
||||
|
return { |
||||
|
brandInfo: {}, |
||||
|
sceneQuery: { |
||||
|
b:'37', |
||||
|
r:'1' |
||||
|
}, |
||||
|
} |
||||
|
}, |
||||
|
onLoad(options){ |
||||
|
// console.log(options) |
||||
|
|
||||
|
// 扫小程序码 |
||||
|
if (options.scene) { |
||||
|
// "r=%s&b=%d" -> rid brand_id -> 绑定接口需要传入 |
||||
|
let sceneQuery = util.formatScene(options.scene); |
||||
|
this.sceneQuery = sceneQuery; |
||||
|
this.getBrandInfo(sceneQuery.b); |
||||
|
} else { |
||||
|
console.log("no scene"); |
||||
|
} |
||||
|
|
||||
|
}, |
||||
|
methods: { |
||||
|
async getuserinfo(userRes){ |
||||
|
if(!userRes.detail.userInfo){ |
||||
|
return util.showNone('获取用户信息失败!请稍后重试'); |
||||
|
} |
||||
|
let loginRes = await uniLogin(); |
||||
|
|
||||
|
if(!loginRes.code){ |
||||
|
return util.showNone('获取登陆凭证失败!稍后重试'); |
||||
|
} |
||||
|
const APPID = uni.getAccountInfoSync().miniProgram.appId; |
||||
|
|
||||
|
let { sceneQuery } = this; |
||||
|
if(!sceneQuery.r)return util.showNone('缺少rid!'); |
||||
|
util.showLoad(); |
||||
|
// 后端说要登陆才能拿到具体身份,不知后端怎么设计关系 |
||||
|
servers.post({ |
||||
|
url: API.assistantAuth, |
||||
|
data: { |
||||
|
appid: APPID, |
||||
|
code: loginRes.code, |
||||
|
encryptedData: userRes.detail.encryptedData, |
||||
|
iv: userRes.detail.iv, |
||||
|
// brand_id: sceneQuery.b, |
||||
|
// rid: sceneQuery.r, |
||||
|
brand_id: 37, |
||||
|
rid: '@ed8dcd', |
||||
|
// 'avatar_url': userRes.detail.userInfo.avatarUrl, |
||||
|
// ...userRes.detail.userInfo, |
||||
|
}, |
||||
|
isDefaultGet: false, |
||||
|
}) |
||||
|
.then(res=>{ |
||||
|
util.hideLoad(); |
||||
|
if(res.data.code == 0){ |
||||
|
let _data = res.data.data; |
||||
|
// if(_data.user.role === '')return util.routeTo(`/pages/merchant_login/merchant_login`,'rT'); |
||||
|
util.showNone(res.data.message || '操作成功!'); |
||||
|
|
||||
|
// uni.setStorageSync('token', _data.token); |
||||
|
// setTimeout(_=>{ |
||||
|
// this.isLogin = app.isLogin(); |
||||
|
// }, 1200); |
||||
|
}else{ |
||||
|
util.showNone(res.data.message || '操作失败!'); |
||||
|
} |
||||
|
|
||||
|
}).catch(util.hideLoad) |
||||
|
}, |
||||
|
getBrandInfo(brand_id){ |
||||
|
util.showLoad(); |
||||
|
servers.get({ |
||||
|
url: API.brandInfo + '/' +brand_id, |
||||
|
data: {}, |
||||
|
failMsg: '加载品牌信息失败!' |
||||
|
}) |
||||
|
.then(res=>{ |
||||
|
util.hideLoad(); |
||||
|
this.brandInfo = res; |
||||
|
console.log(res) |
||||
|
}) |
||||
|
.then(util.hideLoad) |
||||
|
} |
||||
|
} |
||||
|
} |
||||
|
</script> |
||||
|
|
||||
|
<style lang="scss"> |
||||
|
@import "../../style/public.scss"; |
||||
|
page{ |
||||
|
background-color: #fff; |
||||
|
} |
||||
|
.admin-bind{ |
||||
|
padding-top: 150upx; |
||||
|
>image{ |
||||
|
display: block; |
||||
|
margin: 0 auto; |
||||
|
margin-bottom: 30upx; |
||||
|
width: 150upx; |
||||
|
height: 150upx; |
||||
|
} |
||||
|
>view{ |
||||
|
text-align: center; |
||||
|
font-size: 28upx; |
||||
|
color: #1a1a1a; |
||||
|
} |
||||
|
.ab-tip{ |
||||
|
margin-bottom: 50upx; |
||||
|
font-size: 40upx; |
||||
|
font-weight: 500; |
||||
|
} |
||||
|
.ab-brand{ |
||||
|
font-size: 32upx; |
||||
|
margin-bottom: 50upx; |
||||
|
@include textHide(1); |
||||
|
} |
||||
|
>button{ |
||||
|
margin-top: 70upx; |
||||
|
width: 702upx; |
||||
|
height: 88upx; |
||||
|
line-height: 88upx; |
||||
|
text-align: center; |
||||
|
border: none; |
||||
|
border-radius: 10upx; |
||||
|
font-size: 32upx; |
||||
|
color: #fff; |
||||
|
background-color: $themeColor; |
||||
|
|
||||
|
} |
||||
|
} |
||||
|
</style> |
@ -0,0 +1,5 @@ |
|||||
|
// 异步方法
|
||||
|
|
||||
|
export default { |
||||
|
|
||||
|
} |
@ -0,0 +1,16 @@ |
|||||
|
import Vue from 'vue'; |
||||
|
import Vuex from 'vuex'; |
||||
|
import mutations from './mutations'; |
||||
|
import actions from './actions'; |
||||
|
Vue.use(Vuex); |
||||
|
|
||||
|
export default new Vuex.Store({ |
||||
|
state: { |
||||
|
// #ifdef MP-WEIXIN
|
||||
|
APPID: uni.getAccountInfoSync().miniProgram.appId, |
||||
|
// #endif
|
||||
|
brandInfo: {}, |
||||
|
}, |
||||
|
mutations, |
||||
|
actions, |
||||
|
}); |
@ -0,0 +1,10 @@ |
|||||
|
// 同步方法
|
||||
|
|
||||
|
|
||||
|
export default { |
||||
|
// 设置品牌信息
|
||||
|
setBrandInfo(state, brandInfo){ |
||||
|
// console.log(storeInfo,'-----')
|
||||
|
state.brandInfo = brandInfo |
||||
|
}, |
||||
|
} |
@ -1,12 +0,0 @@ |
|||||
|
|
||||
import reservation from '../components/order/reservation/reservation'; |
|
||||
import membership from '../components/order/membership/membership'; |
|
||||
import integral from '../components/order/integral/integral'; |
|
||||
|
|
||||
export const order = { |
|
||||
reservation, |
|
||||
membership, |
|
||||
integral |
|
||||
} |
|
||||
|
|
||||
export default { order }; |
|
Write
Preview
Loading…
Cancel
Save
Reference in new issue