Browse Source

add script

voice
刘嘉炜 5 years ago
parent
commit
6eabb18670
  1. 12
      src/js/api.js
  2. 93
      src/js/server.js
  3. 2
      src/manifest.json
  4. 11
      src/pages.json
  5. 24
      src/pages/employee/manage/manage.vue
  6. 52
      src/pages/index/index.vue
  7. 8
      src/pages/order_list/order_list.vue
  8. 9
      src/pages/store_list/store_list.vue
  9. 9
      src/pages/write_off/list/list.vue

12
src/js/api.js

@ -0,0 +1,12 @@
export const ORIGIN = ``; // 正式
export const API = {
wechatMiniAppLoginAndSync:`${ORIGIN}/user/wechatMiniAppLoginAndSync`, // 小程序授权
}
export default { ORIGIN, API };

93
src/js/server.js

@ -0,0 +1,93 @@
import util from '../utils/util';
// import { app as vm } from '../main';
const islog = false
export class Server {
request(url,data,method,header,isDefaultGet,failMsg){
return new Promise(async (rs,rj)=>{
const _store = vm.$store;
let storeInfo = _store.state.storeInfo || null;
if(storeInfo)data['brand_id'] = storeInfo.brand_id;
const _token = uni.getStorageSync('token') || '';
if(_token)data['token'] = _token;
uni.request({
url,
data,
method, // OPTIONS, GET, HEAD, POST, PUT, DELETE, TRACE, CONNECT
header: {...header}, // 设置请求的 header // {'custom-header': 'application/json'}
success: res=>{
if(islog)console.log('req success---->',{
link: url,
query: data,
method: method,
data: res,
})
if(isDefaultGet){
if(failMsg == '')throw Error('默认回调,失败提示不能为空 key -> failMsg');
defaultGet({
url,
data,
res,
failMsg,
resolve: rs,
reject: rj
});
return
}
rs(res);
},
fail: err=>{
if(islog)console.log('req fail---->',{
link: url,
query: data,
method: method,
data: err,
})
util.hideLoad();
if(typeof(err.errMsg) == 'string'&&(err.errMsg.indexOf('timeout')!=-1 || err.errMsg.indexOf('interrupted')!=-1 || err.errMsg.indexOf('请求超时')!=-1)){
util.showNone('网络超时!');
}else if(typeof(err.errMsg) == 'string'){
util.showNone(err.errMsg);
}else{
util.showNone('请求数据失败!请检查当前网络状态。');
}
rj(err);
},
})
})
function defaultGet({res,failMsg,resolve,reject,url,data}){
if(res.data.code == 0){
resolve(res.data.data);
}else{
util.hideLoad();
util.showNone(res.data.message || failMsg || '');
reject({url,res,data});
}
}
}
get({url,data={},header={},isDefaultGet=true,failMsg=''}){
return this.request(url,data,'GET',header,isDefaultGet,failMsg);
}
post({url,data={},header={'custom-header': 'application/json'},isDefaultGet=true,failMsg=''}){
return this.request(url,data,'POST',header,isDefaultGet,failMsg);
}
uploadFile({url,filePath,onProgressCallBack,formData={}}){
return new Promise((rs,rj)=>{
let uploadTask = wx.uploadFile({
url,filePath,formData,name:'file',success:rs,fail:rj
})
uploadTask.onProgressUpdate(res=>onProgressCallBack&&onProgressCallBack(res))
})
}
}
export const servers = new Server();
export default {servers,Server};

2
src/manifest.json

@ -54,7 +54,7 @@
},
"mp-weixin": { /* */
"appid": "",
"appid": "wxf1294b279ad1b845",
"setting": {
"urlCheck": false
},

11
src/pages.json

@ -1,6 +1,11 @@
{
"pages": [ //pageshttps://uniapp.dcloud.io/collocation/pages
{
"path": "pages/index/index",
"style": {
}
},
{
"path": "pages/turnover/turnover",
"style": {
"navigationBarTitleText": "营业额"
@ -96,11 +101,7 @@
"navigationBarTitleText": "商家登录"
}
},
{
"path": "pages/index/index",
"style": {
}
},
{
"path": "pages/merchant_info/merchant_info",
"style": {

24
src/pages/employee/manage/manage.vue

@ -8,7 +8,7 @@
</view>
</view>
<view class="ec-info">
<view class="ei-add">
<view class="ei-add" @click="addEmployee">
<image mode="aspectFit" src="/static/images/icon/round_add.png"></image>
<text>添加员工</text>
</view>
@ -25,7 +25,7 @@
<view class="eu-name">胡雪儿</view>
<view class="eu-tag">超级管理员</view>
</view>
<view hover-class="hover-active">更换</view>
<view hover-class="hover-active" @click="changeAdmin">更换</view>
</view>
</view>
<view class="ec-employees">
@ -35,13 +35,13 @@
<view>员工总数 <text>3</text></view>
</view>
<view>
<text>筛选</text>
<text @click="toFilter">筛选</text>
<text>删除</text>
<text class="active">取消</text>
</view>
</view>
<view class="ec-lists">
<view class="el-item" v-for="k in 20" :key="k">
<view class="el-item" v-for="k in 20" :key="k" @click="toAuthority">
<view>
<image class="ei-icon"></image>
<image class="ei-avatar"></image>
@ -70,8 +70,22 @@
</view>
</template>
<script>
import util from '../../../utils/util'
export default {
methods: {
addEmployee(){
util.routeTo(`/pages/employee/invite_code/invite_code`, 'nT');
},
changeAdmin(){
util.routeTo(`/pages/employee/change_admin/change_admin`, 'nT');
},
toFilter(){
util.routeTo(`/pages/employee/authority_filter/authority_filter`, 'nT');
},
toAuthority(){
util.routeTo(`/pages/employee/authority_select/authority_select`, 'nT');
}
}
}
</script>
<style lang="scss" scoped>

52
src/pages/index/index.vue

@ -2,11 +2,11 @@
<view class="index-container">
<view class="ic-content">
<view class="ic-header">
<view class="ih-address" v-if="false">
<view class="ih-address" v-if="true" @click="toStoreList">
<view>广州欧轩智能场馆(共6家)</view>
<image src="/static/images/icon/arrow_ff.png" mode="aspectFit"></image>
</view>
<view class="ih-btn" hover-class="hover-active">点击登陆</view>
<view v-else class="ih-btn" hover-class="hover-active" @click="showAuthor">点击登陆</view>
<view class="ih-tip">今日总收入</view>
<view class="ih-price"><text>¥</text>0.00</view>
<view class="ih-amount">
@ -33,20 +33,20 @@
</view>
</view>
<view class="ic-tabs">
<view class="it-item" v-for="e in tabList" :key="e.id">
<view class="it-item" v-for="e in tabList" :key="e.id" @click="toPageInfo(e.path)">
<image mode="aspectFit" :src="'/static/images/icon/index/tab_'+ e.id + '.png'"></image>
<view>{{e.name}}</view>
</view>
</view>
</view>
<view class="ox-dark-mask" v-if="false">
<view class="ox-dark-mask" v-if="isShowAuthorModal">
<view class="ic-author-modal">
<view class="iam-title">微信授权</view>
<view class="iam-tip">您的信息和数据将受到保护</view>
<image class="iam-pic" mode="aspectFit" src="/static/images/icon/author_modal.png"></image>
<view class="iam-btns">
<view hover-class="hover-active">取消</view>
<view hover-class="hover-active">授权并登录</view>
<view hover-class="hover-active" @click="cancelAuthor">取消</view>
<view hover-class="hover-active" @click="confirmAuthor">授权并登录</view>
</view>
</view>
</view>
@ -54,16 +54,17 @@
</template>
<script>
import util from '../../utils/util';
const tabList = [
{
id: 0,
name: '营业额',
path: ''
path: '/pages/turnover/turnover'
},
{
id: 1,
name: '收款记录',
path: ''
path: '/pages/collection/record/record'
},
{
id: 2,
@ -73,27 +74,27 @@
{
id: 3,
name: '场馆订单',
path: ''
path: '/pages/order_list/order_list'
},
{
id: 4,
name: '会员卡订单',
path: ''
path: '/pages/order_list/order_list'
},
{
id: 5,
name: '积分订单',
path: ''
path: '/pages/order_list/order_list'
},
{
id: 6,
name: '员工管理',
path: ''
path: '/pages/employee/manage/manage'
},
{
id: 7,
name: '核销查询',
path: ''
path: '/pages/write_off/list/list'
},
{
id: 8,
@ -104,14 +105,35 @@
export default {
data() {
return {
tabList
tabList,
isShowAuthorModal: false,
}
},
onLoad() {
onLoad() {
},
methods: {
showAuthor(){
this.isShowAuthorModal = true
},
closeAuthor(){
this.isShowAuthorModal = false
},
cancelAuthor(){
this.closeAuthor();
},
confirmAuthor: util.debounce(function(){
this.closeAuthor();
}, 300, 300),
toPageInfo(path){
if(!path)return util.showNone('暂未开放!');
util.routeTo(path,'nT');
},
toStoreList(){
util.routeTo(`/pages/store_list/store_list`,'nT');
}
}
}
</script>

8
src/pages/order_list/order_list.vue

@ -20,7 +20,7 @@
<view class="oc-bot">
<view>成功交易245笔退款25笔</view>
<view class="ob-btns">
<image mode="aspectFit" src="/static/images/icon/search.png"></image>
<image mode="aspectFit" @click="toSearch" src="/static/images/icon/search.png"></image>
<image mode="aspectFit" src="/static/images/icon/filter.png"></image>
</view>
</view>
@ -82,11 +82,17 @@
<script>
import { order } from '../../utils/components';
import util from '../../utils/util';
export default {
components: {
'reservation-order': order.reservation,
'membership-order': order.membership,
'integral-order': order.integral,
},
methods: {
toSearch(){
util.routeTo(`/pages/order_search/order_search`,'nT');
}
}
}
</script>

9
src/pages/store_list/store_list.vue

@ -5,7 +5,7 @@
<view class="si-tit">欧轩智能羽毛球馆永泰店</view>
<view class="si-info">
<view>营业状态正常</view>
<view>
<view @click="toDetail">
<view>微信商户号17098768441</view>
<image mode="aspectFit" src="/static/images/icon/arrow_b2.png"></image>
</view>
@ -17,8 +17,13 @@
</template>
<script>
import util from '../../utils/util'
export default {
methods: {
toDetail(){
util.routeTo(`/pages/merchant_info/merchant_info`,'nT');
}
}
}
</script>

9
src/pages/write_off/list/list.vue

@ -1,6 +1,6 @@
<template>
<view class="write-off-list">
<view class="wol-btn" hover-class="hover-active">
<view class="wol-btn" hover-class="hover-active" @click="scanCode">
<image mode="aspectFit" src="/static/images/icon/scan_code_btn.png"></image>
</view>
<view class="wol-bar">今日核销订单(2)</view>
@ -57,8 +57,13 @@
</template>
<script>
import util from '../../../utils/util'
export default {
methods: {
scanCode(){
util.routeTo(`/pages/write_off/confirm/confirm`,'nT')
}
}
}
</script>

Loading…
Cancel
Save