瀏覽代碼

整改订单列表页,登录把字典存入vuex

jf 5 年之前
父節點
當前提交
aec024d19a

+ 28 - 5
ghsApp/src/App.vue

@@ -1,12 +1,35 @@
 <script>
 <script>
+import store from '@/store'
 	import { mapMutations, mapActions, mapGetters } from 'vuex'
 	import { mapMutations, mapActions, mapGetters } from 'vuex'
 	import { setTimeout } from 'timers'
 	import { setTimeout } from 'timers'
 	import { getUser, wxLoginFn } from '@/utils/auth'
 	import { getUser, wxLoginFn } from '@/utils/auth'
+	import { getDictionaries } from '@/api/mini'
+	import util from "./utils/util";
 	export default {
 	export default {
 		// 全端,数据共享,还可以解决页面初始化模板访问不到值得
 		// 全端,数据共享,还可以解决页面初始化模板访问不到值得
 		// 有坑 分包里的页面访问不到
 		// 有坑 分包里的页面访问不到
 		globalData: {},
 		globalData: {},
 		onLaunch() {
 		onLaunch() {
+			// #ifdef H5
+			// H5开发环境无法微信授权,使用固定的用户 shish 2020.4.30
+			if (process.env.NODE_ENV == "development") {
+				uni.setStorageSync(
+					"token",
+					"eyJ0eXAiOiJKV1QiLCJhbGciOiJIUzI1NiIsImp0aSI6IjBfNTIifQ.eyJpc3MiOiJodHRwczpcL1wvYXBpLnNob3AuaHpnaGQuY29tIiwiYXVkIjoiaHR0cHM6XC9cL2FwaS5zaG9wLmh6Z2hkLmNvbSIsImp0aSI6IjBfNTIiLCJpYXQiOjE2MTYxNTc2NjQsIm5iZiI6MTYxNjE1NzY2NCwiZXhwIjoxNjI0Nzk3NjY0LCJ1bmlxdWVJZCI6IjUyIiwic291cmNlSWQiOjB9.VzSekbSwSczMWsfdPVdrm3gZ-v9o3p01NbMVNT4nGZ4"
+				);
+				uni.setStorageSync("account", "0");
+				getDictionaries({ token: uni.getStorageSync('token') }).then(res => {
+					if (util.isEmpty(res)) {
+						return false
+					}
+					store.commit('setDictionariesInfo', {
+						...res.data.dict,
+						...res.data
+					})
+				})
+			}
+			// #endif
+
 			// 删除缓存
 			// 删除缓存
 			if (process.env.NODE_ENV == 'production') {
 			if (process.env.NODE_ENV == 'production') {
 				uni.removeStorageSync('shopUser')
 				uni.removeStorageSync('shopUser')
@@ -16,7 +39,7 @@
 			// uni.clearStorage()
 			// uni.clearStorage()
 			const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
 			const extConfig = wx.getExtConfigSync ? wx.getExtConfigSync() : {}
 			uni.setStorageSync('account', extConfig.account)
 			uni.setStorageSync('account', extConfig.account)
-			
+
 			// #endif
 			// #endif
 			wxLoginFn(true)
 			wxLoginFn(true)
 				.then(res => {
 				.then(res => {
@@ -43,7 +66,7 @@
 									url: "/pagesClient/official/latest-shop",
 									url: "/pagesClient/official/latest-shop",
 									type: 2,
 									type: 2,
 									query:{
 									query:{
-										...this.option	
+										...this.option
 									}
 									}
 								});
 								});
 							}
 							}
@@ -54,16 +77,16 @@
 									url: "/pagesClient/official/index",
 									url: "/pagesClient/official/index",
 									type: 2,
 									type: 2,
 									query: {
 									query: {
-										...this.option	
+										...this.option
 									}
 									}
 								});
 								});
-							}	
+							}
 						}
 						}
 					}
 					}
 					getUser(true)
 					getUser(true)
 					//获取门店信息
 					//获取门店信息
 					this.setUserShopAll()
 					this.setUserShopAll()
-					
+
 				})
 				})
 		},
 		},
 		onLoad(){
 		onLoad(){

+ 72 - 14
ghsApp/src/admin/home/order.vue

@@ -2,25 +2,28 @@
 	<div class="app-main app-content">
 	<div class="app-main app-content">
 		<view class="input-wrap_box">
 		<view class="input-wrap_box">
 			<view>
 			<view>
-				<AppSearchModule placeholder="请输入关键词搜索" @search="searchFn" />
+				<AppSearchModule placeholder="请输入客户名称,支持拼音首字母搜索" @search="searchFn" />
 			</view>
 			</view>
 
 
 			<view class="select-dn_bx">
 			<view class="select-dn_bx">
-				<DorpdownSelect 
+				<DorpdownSelect
+					:menuObj="menuObj"
 					:selectItemId.sync="selectItemId"
 					:selectItemId.sync="selectItemId"
-					:typeSelect="1" top="0px" 
+					:typeSelect="1" top="0px"
 					@selectSussess="selectSussess" />
 					@selectSussess="selectSussess" />
 			</view>
 			</view>
 		</view>
 		</view>
+		<view class="app-tabs">
 		<app-tabs
 		<app-tabs
 			:tabs="tabs"
 			:tabs="tabs"
-			:isFixed="true"
+			:isFixed="false"
 			:top="50"
 			:top="50"
 			:currentTab="tabIndex"
 			:currentTab="tabIndex"
 			:height="100"
 			:height="100"
 			@change="change"
 			@change="change"
 			itemWidth="20%"
 			itemWidth="20%"
 		/>
 		/>
+		</view>
 		<div class="list-wrap">
 		<div class="list-wrap">
 			<block v-if="!$util.isEmpty(list.data)">
 			<block v-if="!$util.isEmpty(list.data)">
 				<div
 				<div
@@ -82,6 +85,7 @@
 									v-if="s.show == 1"
 									v-if="s.show == 1"
 									:disabled="s.disable === 1"
 									:disabled="s.disable === 1"
 									class="admin-button-com bule"
 									class="admin-button-com bule"
+									:class="s.disable === 1?'active':''"
 								>
 								>
 									{{
 									{{
 										s.type === "item" ? "改花材" : s.type === "selfGet" ? "自取" : "发货"
 										s.type === "item" ? "改花材" : s.type === "selfGet" ? "自取" : "发货"
@@ -106,10 +110,21 @@
 			:size="32"
 			:size="32"
 			padding="30rpx 30rpx"
 			padding="30rpx 30rpx"
 		></modal-module>
 		></modal-module>
+<!--		时间段选择-->
+		<rangeDatePick
+			:show="isShow"
+			start="2000-01-01"
+			end="2200-12-01"
+			:value="customizationTime"
+			@change="timeChange"
+			@cancel="timeCancel"
+			themeColor="#4C83D6" fields="day"></rangeDatePick>
 	</div>
 	</div>
 </template>
 </template>
 
 
 <script>
 <script>
+const Month = (new Date().getMonth()+1)<10?'0'+(new Date().getMonth()+1):new Date().getMonth()+1
+const time = `${new Date().getFullYear()}-${Month}-${new Date().getDate()}`;
 import AppTabs from "@/components/plugin/tabs";
 import AppTabs from "@/components/plugin/tabs";
 // import ListModule from "@/components/module/app-order-list";
 // import ListModule from "@/components/module/app-order-list";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
@@ -122,10 +137,12 @@ import { getListB, freeShipping } from "@/api/order";
 import AppSearchModule from "@/components/module/app-search";
 import AppSearchModule from "@/components/module/app-search";
 import DorpdownSelect from "@/components/module/dorpdownSelect";
 import DorpdownSelect from "@/components/module/dorpdownSelect";
 import AppAvatarModule from "@/components/module/app-avatar";
 import AppAvatarModule from "@/components/module/app-avatar";
+import rangeDatePick from '@/components/pyh-rdtpicker/pyh-rdtpicker.vue';
 export default {
 export default {
 	name: "order-list",
 	name: "order-list",
 	components: {
 	components: {
 		// ListModule,
 		// ListModule,
+		rangeDatePick,
 		AppTabs,
 		AppTabs,
 		AppWrapperEmpty,
 		AppWrapperEmpty,
 		ModalModule,
 		ModalModule,
@@ -134,8 +151,14 @@ export default {
 		AppAvatarModule
 		AppAvatarModule
 	},
 	},
 	mixins: [list],
 	mixins: [list],
+	computed: {		...mapGetters(["getLoginInfo","getDictionariesInfo"])	},
 	data() {
 	data() {
 		return {
 		return {
+			seekVal: '',
+			isShow: false,//是否显选择时间段
+			customizationTime:[],//时间段
+			customizationTimeType:'',//时间段
+			menuObj:'',//时间筛选列表
 			tabIndex: 0,
 			tabIndex: 0,
 			// classifyModal:false,
 			// classifyModal:false,
 			tabs: [
 			tabs: [
@@ -164,7 +187,7 @@ export default {
 					value: 0,
 					value: 0,
 					id: 6
 					id: 6
 				},
 				},
-				
+
 			],
 			],
 			selectItemId:'',
 			selectItemId:'',
 			operateIndex: null,
 			operateIndex: null,
@@ -192,20 +215,22 @@ export default {
 			uni.stopPullDownRefresh();
 			uni.stopPullDownRefresh();
 		}
 		}
 	},
 	},
-	computed: {
-	},
 	mounted() {
 	mounted() {
-		// console.log(1111,this.option.tabIndex)
 		// getCategory()
 		// getCategory()
 		// getUsage()
 		// getUsage()
 	},
 	},
 	onLoad(option) {
 	onLoad(option) {
+		let dateDefaultOption = [];
+		let list = this.getDictionariesInfo.dateDefaultOption;
+		for (let i=0;i<list.length;i++){
+			dateDefaultOption.push({name:list[i].name,id:list[i].value})
+		}
+		this.menuObj = {title:'时间',titleChild:'时间',list: dateDefaultOption};
 		let tabIndex = uni.getStorageSync("switchTabQuery") || null;
 		let tabIndex = uni.getStorageSync("switchTabQuery") || null;
 		if (tabIndex) {
 		if (tabIndex) {
 		  uni.removeStorageSync("switchTabQuery");
 		  uni.removeStorageSync("switchTabQuery");
 		  this.tabIndex = parseInt(tabIndex.tabIndex);
 		  this.tabIndex = parseInt(tabIndex.tabIndex);
 		}
 		}
-		this._list();
 	},
 	},
 	onShow() {
 	onShow() {
 		let tabIndex = uni.getStorageSync("switchTabQuery") || null;
 		let tabIndex = uni.getStorageSync("switchTabQuery") || null;
@@ -216,6 +241,19 @@ export default {
 		 this._list();
 		 this._list();
 	},
 	},
 	methods: {
 	methods: {
+		selectTime(type){
+			this.customizationTime = [time,time],
+			this.customizationTimeType = type,
+			this.isShow = true;
+		},
+		//选择自定义时间确定
+		timeChange(e){
+			this.isShow = false;
+			this.resetList();
+			this._list(this.customizationTimeType,e);
+		},
+		//选择自定义时间取消
+		timeCancel(e){this.isShow = false;},
 		statusFormat(status) {
 		statusFormat(status) {
 			switch (status) {
 			switch (status) {
 				case "1":
 				case "1":
@@ -261,13 +299,26 @@ export default {
 		selectSussess(val) {
 		selectSussess(val) {
 			// this._list();
 			// this._list();
 			console.log(val);
 			console.log(val);
+			if(val.select=='自定义'){
+				this.selectTime(val.selectItem.id);
+			}else{
+				this.resetList();
+				this._list(val.selectItem.id,'');
+			}
+		},
+		searchFn(e) {
+			this.resetList();
+			this.seekVal = e;
+			this._list();
 		},
 		},
-		searchFn() {},
-		_list() {
+		_list(type,timeArr) {
 			return getListB({
 			return getListB({
+				searchTime:type,
+				startTime:timeArr?timeArr[0]:'',
+				endTime:timeArr?timeArr[1]:'',
 				status: this.tabs[this.tabIndex].id,
 				status: this.tabs[this.tabIndex].id,
-				search: "",
-				page: this.list.page
+				name: this.seekVal,
+				page: this.list.page,
 			}).then(res => {
 			}).then(res => {
 				this.completes(res);
 				this.completes(res);
 				if (this.$util.isEmpty(res.data)) return false;
 				if (this.$util.isEmpty(res.data)) return false;
@@ -357,13 +408,19 @@ export default {
 	line-height: 60px;
 	line-height: 60px;
 	text-align: center;
 	text-align: center;
 	font-size: 26px;
 	font-size: 26px;
+	&.active{
+		border: 1px solid #ccc;
+	}
 }
 }
 .app-content {
 .app-content {
-	padding-top: 220px;
+	padding-top: 100px;
 	padding-bottom: 1px;
 	padding-bottom: 1px;
 	.select-dn_bx {
 	.select-dn_bx {
 		padding-left: 48px;
 		padding-left: 48px;
 	}
 	}
+	.app-tabs{
+		position: fixed;width:100%;z-index: 9;
+	}
 	.input-wrap_box {
 	.input-wrap_box {
 		background-color: #fff;
 		background-color: #fff;
 		position: fixed;
 		position: fixed;
@@ -379,6 +436,7 @@ export default {
 		}
 		}
 	}
 	}
 	.list-wrap {
 	.list-wrap {
+		padding-top: 100rpx;
 		.list {
 		.list {
 			background-color: #fff;
 			background-color: #fff;
 			margin-bottom: 20px;
 			margin-bottom: 20px;

+ 6 - 1
ghsApp/src/api/mini/index.js

@@ -6,7 +6,12 @@ import https from '@/plugins/luch-request_0.0.7/request'
 export const postWxCode = data => {
 export const postWxCode = data => {
 	return https.get('/auth/mini-info', data)
 	return https.get('/auth/mini-info', data)
 }
 }
-
+/** *
+	* 点击授权获取字典
+	*/
+export const getDictionaries = data => {
+	return https.get('/console/init', data)
+}
 /** *
 /** *
  * 点击授权获取用户信息 mini
  * 点击授权获取用户信息 mini
  */
  */

+ 26 - 21
ghsApp/src/components/module/dorpdownSelect.vue

@@ -1,15 +1,16 @@
 <template>
 <template>
     <view class="select-bg_bx">
     <view class="select-bg_bx">
+
         <view
         <view
             v-if="isShowTit"
             v-if="isShowTit"
             @click="switchCut"
             @click="switchCut"
             :class="['select-title',dropdownShow?'select_corlor':'']">
             :class="['select-title',dropdownShow?'select_corlor':'']">
-            {{menuObj.title}}
+            {{menuObjActive?menuObjActive:menuObj.title}}
             <i class="iconfont iconsanjiao_xia"></i>
             <i class="iconfont iconsanjiao_xia"></i>
         </view>
         </view>
-         <view 
+         <view
             class="select-mark-view" v-show="dropdownShow" @click="switchCut"></view>
             class="select-mark-view" v-show="dropdownShow" @click="switchCut"></view>
-        <view 
+        <view
             v-if="dropdownShow"
             v-if="dropdownShow"
             :style="{
             :style="{
                 top
                 top
@@ -19,7 +20,7 @@
                 <view class="select-item-box">
                 <view class="select-item-box">
                     <view class="title">{{menuObj.titleChild}}</view>
                     <view class="title">{{menuObj.titleChild}}</view>
                     <view class="item-child_box">
                     <view class="item-child_box">
-                        <button 
+                        <button
                             v-for="(item,index) in menuObj.list"
                             v-for="(item,index) in menuObj.list"
                             :key="index"
                             :key="index"
                             @click="changeItem(item)"
                             @click="changeItem(item)"
@@ -28,17 +29,18 @@
                         </button>
                         </button>
                     </view>
                     </view>
                 </view>
                 </view>
-                <view 
+                <view
                     v-if="typeSelect === 1"
                     v-if="typeSelect === 1"
                     class="select-item-box">
                     class="select-item-box">
                     <view class="title">其他时间选择</view>
                     <view class="title">其他时间选择</view>
-                    <view class="item-child_box">
-                        <picker
-                            class="admin-button-com mini-btn default custom"
-                                mode="date" :value="selectItemId" @change="endTimeFn">
-                            <div v-if="selectItemId&&formatSelect">{{ selectItemId }}</div>
-                            <div class="tui-placeholder" v-else>自定义时间</div>
-                        </picker>
+                    <view class="item-child_box" >
+																								<view class="admin-button-com mini-btn default custom" @tap="changeItem({name:'自定义',id:'custom'})">自定义</view>
+<!--                        <picker-->
+<!--                            class="admin-button-com mini-btn default custom"-->
+<!--                                mode="date" :value="selectItemId" @change="endTimeFn">-->
+<!--                            <div v-if="selectItemId&&formatSelect">{{ selectItemId }}</div>-->
+<!--                            <div class="tui-placeholder" v-else>自定义时间</div>-->
+<!--                        </picker>-->
                     </view>
                     </view>
                 </view>
                 </view>
             </slot>
             </slot>
@@ -49,12 +51,11 @@
 <script>
 <script>
     import DropdownList from "@/components/plugin/dropdown-list";
     import DropdownList from "@/components/plugin/dropdown-list";
     import AppDatePicker from "@/components/app-date-picker";
     import AppDatePicker from "@/components/app-date-picker";
-    
+				import rangeDatePick from '@/components/pyh-rdtpicker/pyh-rdtpicker.vue';
     export default {
     export default {
         name:'DorpdownSelect',
         name:'DorpdownSelect',
         components:{
         components:{
-            DropdownList,
-            AppDatePicker
+            DropdownList,AppDatePicker,rangeDatePick
         },
         },
         props:{
         props:{
             menuObj:{
             menuObj:{
@@ -62,7 +63,7 @@
                 default: ()=>({
                 default: ()=>({
                     title:'时间',
                     title:'时间',
                     titleChild:'时间',
                     titleChild:'时间',
-                    list: [{name:'昨天',id:'0'},{name:'今天',id:'1'},{name:'本月',id:'2'},{name:'上月',id:'3'},{name:'今年',id:'4'}]  
+                    list: [{name:'昨天',id:'0'},{name:'今天',id:'1'},{name:'本月',id:'2'},{name:'上月',id:'3'},{name:'今年',id:'4'}]
                 })
                 })
             },
             },
             // 1 是时间  2是其他
             // 1 是时间  2是其他
@@ -87,6 +88,7 @@
             return {
             return {
                 dropdownShow: false,
                 dropdownShow: false,
                 selectItem:'',
                 selectItem:'',
+																menuObjActive:'',
             }
             }
         },
         },
         computed:{
         computed:{
@@ -103,13 +105,15 @@
         mounted(){
         mounted(){
 
 
         },
         },
+							onLoad(){
+
+							},
         methods:{
         methods:{
-            
             switchCut(){
             switchCut(){
                 this.dropdownShow = !this.dropdownShow
                 this.dropdownShow = !this.dropdownShow
             },
             },
             changeItem(val){
             changeItem(val){
-                if(val.id== this.selectItemId){
+                if(val.id== this.selectItemId&&val.name!='自定义'){
                     return false
                     return false
                 }
                 }
                 this.$emit('update:selectItemId',val.id)
                 this.$emit('update:selectItemId',val.id)
@@ -120,6 +124,7 @@
                     ...this.menuObj,
                     ...this.menuObj,
                     title:val.name
                     title:val.name
                 })
                 })
+																this.menuObjActive = val.name;
 
 
                 this.$emit('selectSussess',{
                 this.$emit('selectSussess',{
                     select: this.$util.isString(val)?val:val.name,
                     select: this.$util.isString(val)?val:val.name,
@@ -198,7 +203,7 @@
                     flex-flow: wrap;
                     flex-flow: wrap;
                     justify-content: space-between;
                     justify-content: space-between;
                     & .admin-button-com {
                     & .admin-button-com {
-                        
+
                         margin-bottom: 20px;
                         margin-bottom: 20px;
                         padding: 18px 50px;
                         padding: 18px 50px;
                         &.custom {
                         &.custom {
@@ -209,5 +214,5 @@
             }
             }
         }
         }
     }
     }
-    
-</style>
+
+</style>

+ 378 - 0
ghsApp/src/components/pyh-rdtpicker/pyh-rdtpicker.vue

@@ -0,0 +1,378 @@
+<template>
+	<view class="rpickerBox">
+		<view :class="{'pickerMask':showPicker}" @click="maskClick"  @touchmove.stop.prevent="returnHandle">
+			<view class="r-dtpicker" :class="{'r-dtpicker-show':showPicker}">
+				<view class="rdtBtn" @touchmove.stop.prevent="returnHandle" @tap.stop="returnHandle">
+					<view @click="pickerCancel">取消</view>
+					<view :style="{color:themeColor}" @click="pickerConfirm">确定</view>
+				</view>
+				<view class="rangeBox" @touchmove.stop.prevent="returnHandle" @tap.stop="returnHandle">
+					<input type="text" disabled placeholder="开始时间" :value="startDate" :style="{color:themeColor,'border-color':themeColor,opacity:dateType=='startDate'?1:.5}" @tap="changeDateType('startDate')">至<input type="text" disabled placeholder="结束时间" :style="{color:themeColor,'border-color':themeColor,opacity:dateType=='endDate'?1:.5}" :value="endDate" @tap="changeDateType('endDate')">
+				</view>
+				<picker-view indicator-style="height: 40px;" class="mpvue-picker-view" :value="pickerValue" @change="pickerChangeMul">
+					<block>
+						<picker-view-column>
+							<view class="picker-item" v-for="(item,index) in yearArr" :key="index">{{item}}</view>
+						</picker-view-column>
+						<picker-view-column v-if="fields!='year'">
+							<view class="picker-item" v-for="(item,index) in monthArr" :key="index">{{item}}</view>
+						</picker-view-column>
+						<picker-view-column v-if="fields=='day'">
+							<view class="picker-item" v-for="(item,index) in dayArr" :key="index">{{item}}</view>
+						</picker-view-column>
+					</block>
+				</picker-view>
+			</view>
+		</view>
+	</view>
+</template>
+
+<script>
+	export default {
+		name: 'range-dtpicker',
+		props: {
+			//粒度
+			fields:{
+			  type: String,
+			  default: 'day'
+			},
+			/**
+			 * picker允许选中的最小值
+			 */
+			start: {
+			  type: String,
+			  default: '1900-01-01'
+			},
+			/**
+			 * picker允许选中的最大值
+			 */
+			end: {
+			  type: String,
+			  default: '2200-12-01'
+			},
+			/**
+			 * picker默认展示的值
+			 */
+			value: {
+                type: Array,
+                default(){
+					return [0,0]
+				}
+            },
+			//是否显示
+			show: {
+				type: Boolean,
+				default: false
+			},
+			/**
+			主题色
+			*/
+			themeColor:{
+			  type: String,
+			  default: '#4C83D6'
+			}
+		},
+		created() {
+			this.init()
+		},
+		data() {
+			return {
+				showPicker: this.show,
+				dayArr:[],
+				pickerValue:this.fields=='year'?[0]:this.fields=='month'?[0,0]:[0,0,0],
+				dateType:"startDate",
+				startDate:'',
+				endDate:""
+			};
+		},
+		watch: {
+			value(value){
+				this.value=value;
+				this.init()
+			},
+			show(isShow) {
+				this.showPicker = isShow;
+			}
+		},
+		computed: {
+			yearArr(){
+				var arr = [],start = parseInt(this.start.slice(0,4)),end=parseInt(this.end.slice(0,4));
+				for(var i=0;i<=end-start;i++){
+					arr.push(start+i)
+				}
+				return arr;
+			},
+			monthArr(){
+				var arr = [];
+				for(var i=1;i<=12;i++){
+					var v = i;
+					if(v<10)v="0"+v;
+					if(this.start.length>4&&this.end.length>4&&(this.start.slice(0,4)==this.end.slice(0,4))){
+						if(parseInt(v)>=this.start.slice(5,7)&&parseInt(v)<=this.end.slice(5,7)){
+							arr.push(v.toString())
+						}
+					}else{
+						arr.push(v.toString())
+					}
+				}
+				return arr;
+			}
+		},
+		methods:{
+			returnHandle(){},
+			init(){
+				var that = this,pickerValue="";
+				if((this.fields=='year'&&this.start.length!=4)||(this.fields=='month'&&this.start.length!=7)||(this.fields=='day'&&this.start.length!=10)){
+					console.error("最小值格式与粒度格式不符");return;
+				}else if((this.fields=='year'&&this.end.length!=4)||(this.fields=='month'&&this.end.length!=7)||(this.fields=='day'&&this.end.length!=10)){
+					console.error("最大值格式与粒度格式不符");return;
+				}
+				var start=this.fields=='year'?this.start.slice(0,4):this.fields=='month'?this.start.slice(0,7):this.start,
+					end=this.fields=='year'?this.end.slice(0,4):this.fields=='month'?this.end.slice(0,7):this.end;
+				if(!start||!end){
+					console.error("时间不能为空");return;
+				}else if(start>end){
+					console.error("结束时间必须大等于开始时间");return;
+				}
+				if(this.value[0]){
+					if((this.fields=='year'&&this.value[0].length!=4)||(this.fields=='month'&&this.value[0].length!=7)||(this.fields=='day'&&this.value[0].length!=10)){
+						console.error("默认值格式与粒度格式不符");return;
+					}
+					this.startDate=this.value[0];
+					if(this.value[1]){
+						if((this.fields=='year'&&this.value[1].length!=4)||(this.fields=='month'&&this.value[1].length!=7)||(this.fields=='day'&&this.value[1].length!=10)){
+							console.error("默认值格式与粒度格式不符");return;
+						}
+						this.endDate=this.value[1];
+						this.dateType="endDate";
+						if(this.fields=='day')this.dayArr=this.getMonthDay(this.value[1].slice(0,4),this.value[1].slice(5,7));
+						pickerValue=this.getIndex(this.value[1]);
+					}else{
+						this.dateType="startDate";
+						if(this.fields=='day')this.dayArr=this.getMonthDay(this.value[0].slice(0,4),this.value[0].slice(5,7));
+						pickerValue=this.getIndex(this.value[0]);
+					}
+				}else{
+					this.startDate=start;
+					pickerValue=this.getIndex(start);
+					if(this.fields=='day')this.dayArr=this.getMonthDay(start.slice(0,4),start.slice(5,7));
+				}
+				if(pickerValue)setTimeout(function(){that.pickerValue=pickerValue},20)
+			},
+			maskClick(){
+				this.$emit("showchange",false);
+			},
+			pickerConfirm(){
+				if(this.endDate<this.startDate){
+					uni.showToast({
+						title:"结束时间不得小于开始时间",
+						icon:"none",
+						mask:true
+					})
+					return;
+				}
+				this.$emit("change",[this.startDate,this.endDate]);
+				this.$emit("showchange",false);
+			},
+			pickerCancel(){
+				this.$emit("cancel");
+				this.$emit("showchange",false);
+			},
+			changeDateType(dateType){
+				var that = this;
+				this.dateType=dateType;
+				if(this[dateType]){
+					this.pickerValue=this.getIndex(this[dateType])
+				}else{
+					var dateTxt=this.fields=='year'?this.yearArr[this.pickerValue[0]]:this.fields=='month'?this.yearArr[this.pickerValue[0]]+'-'+this.monthArr[this.pickerValue[1]]:this.yearArr[this.pickerValue[0]]+'-'+this.monthArr[this.pickerValue[1]]+'-'+this.dayArr[this.pickerValue[2]];
+					this[dateType]=dateTxt;
+					this.pickerValue=this.fields=='year'?[this.pickerValue[0]]:this.fields=='month'?[this.pickerValue[0],this.pickerValue[1]]:[this.pickerValue[0],this.pickerValue[1],this.pickerValue[2]];
+				}
+			},
+			pickerChangeMul(e){
+				var that=this,val = e.detail.value,dateTxt="";
+				if(this.fields=='day'&&(val[0]!=this.pickerValue[0]||val[1]!=this.pickerValue[1])){
+					this.dayArr=this.getMonthDay(this.yearArr[val[0]],this.monthArr[val[1]])
+					function returnMax(){
+						if(!that.dayArr[val[2]]){
+							val[2]=(val[2]-1)
+							returnMax()
+						}
+					}
+					returnMax()
+				}
+				dateTxt=this.yearArr[val[0]]+'-'+this.monthArr[val[1]]+'-'+this.dayArr[val[2]];
+				this[this.dateType]=this.fields=='year'?dateTxt.slice(0,4):this.fields=='month'?dateTxt.slice(0,7):dateTxt;
+				this.pickerValue=this.getIndex(this[this.dateType]);
+			},
+			getIndex(value){
+				var year = value.slice(0,4),month=value.slice(5,7),day=value.slice(8,10),y=0,m=0,d=0;
+				for(var i in this.yearArr){
+					if(year==this.yearArr[i]){
+						y=i;break;
+					}
+				}
+				for(var i in this.monthArr){
+					if(month==this.monthArr[i]){
+						m=i;break;
+					}
+				}
+				for(var i in this.dayArr){
+					if(day==this.dayArr[i]){
+						d=i;break;
+					}
+				}
+				var value = [];
+				switch (this.fields){
+					case 'year':value = [Number(y)]
+						break;
+					case 'month':value = [Number(y),Number(m)]
+						break;
+					default:value = [Number(y),Number(m),Number(d)]
+						break;
+				}
+				return value;
+			},
+			withData: (num) => {
+				let param = parseInt(num);
+			  return param < 10 ? '0' + param : '' + param;
+			},
+			getLoopArray(start, end,specialDay){
+			  var start = start || 0;
+			  var end = end || 1;
+			  var array = [];
+				if(specialDay){
+					array=specialDay;
+					return array;
+				}
+			  for (var i = start; i <= end; i++) {
+			    array.push(this.withData(i));
+			  }
+			  return array;
+			},
+			getMonthDay(year, month,specialDay){
+			  var flag = year % 400 == 0 || (year % 4 == 0 && year % 100 != 0), array = null;
+
+			  switch (month) {
+			    case '01':
+			    case '03':
+			    case '05':
+			    case '07':
+			    case '08':
+			    case '10':
+			    case '12':
+			      array = this.getLoopArray(1, 31,specialDay)
+			      break;
+			    case '04':
+			    case '06':
+			    case '09':
+			    case '11':
+			      array = this.getLoopArray(1, 30,specialDay)
+			      break;
+			    case '02':
+			      array = flag ? this.getLoopArray(1, 29,specialDay) : this.getLoopArray(1, 28,specialDay)
+			      break;
+			    default:
+			      array = '月份格式不正确,请重新输入!'
+			  }
+			  return array;
+			}
+		}
+	}
+</script>
+
+<style>
+    .pickerMask {
+        position: fixed;
+        z-index: 998;
+        top: 0;
+        right: 0;
+        left: 0;
+        bottom: 0;
+        background: rgba(0, 0, 0, 0.6);
+    }
+
+    .r-dtpicker {
+        position: fixed;
+        bottom: 0;
+        left: 0;
+        width: 100%;
+					/*height: 600rpx;*/
+        transition: all 0.3s ease;
+        transform: translateY(100%);
+        z-index: 998;
+    }
+
+    .r-dtpicker-show {
+        transform: translateY(0);
+    }
+
+    .rdtBtn {
+        display: flex;
+        padding: 20rpx 15px;
+        background-color: #fff;
+        position: relative;
+        text-align: center;
+        font-size: 32rpx;
+    }
+
+    .rdtBtn:after {
+        content: ' ';
+        position: absolute;
+        left: 0;
+        bottom: 0;
+        right: 0;
+        height: 1px;
+        border-bottom: 1px solid #e5e5e5;
+        color: #e5e5e5;
+        transform-origin: 0 100%;
+        transform: scaleY(0.5);
+    }
+
+    .rdtBtn view{
+        display: block;
+        flex: 1;
+        color: #1aad19;
+    }
+
+    .rdtBtn view:first-child {
+        text-align: left;
+        color: #888;
+    }
+
+    .rdtBtn view:last-child {
+        text-align: right;
+    }
+
+    .picker-item {
+        text-align: center;
+        line-height: 40px;
+        font-size: 24px;
+    }
+
+    .mpvue-picker-view {
+        position: relative;
+        bottom: 0;
+        left: 0;
+        width: 100%;
+        height: 400px;
+        background-color: rgba(255, 255, 255, 1);
+    }
+	.rangeBox{
+		background: #fff;
+		display: flex;
+		justify-content: center;
+		padding: 15px 0;
+		font-size: 26rpx;
+		align-items: center;
+	}
+	.rangeBox input{
+		width: 180upx;
+		margin: 0 10px;
+		text-align: center;
+		align-items: center;
+		display: flex;
+		min-height: auto;
+		border-bottom: 1px solid #000;
+	}
+</style>

+ 79 - 0
ghsApp/src/components/pyh-rdtpicker/readme.md

@@ -0,0 +1,79 @@
+### pyh-rdtPicker 日期区间选择器
+
+可进行多粒度的时间选择器,组件名:``pyh-rdtpicker``,代码块: rangeDatePick。
+
+**使用方式:**
+
+在 ``script`` 中引用组件 
+
+```javascript
+import rangeDatePick from '@/components/pyh-rdtpicker/pyh-rdtpicker.vue';
+export default {
+    components: {rangeDatePick}
+}
+```
+
+在 ``template`` 中使用组件
+
+```html
+<rangeDatePick 
+	:show="isShow"
+	@showchange="showchange"
+	start="1900-01-01"
+	end="2200-12-01"
+	:value="value"
+	@change="bindChange"
+	@cancel="bindCancel"
+	themeColor="#4C83D6"
+	fields="month"
+></rangeDatePick>
+```
+
+**pdtPicker 属性说明:**
+
+|属性名		|类型	|默认值	                    |说明					|
+|---		|----	|---	                    |---					|
+|themeColor	|String	|'#4C83D6'	            	|主题色					|
+|start		|String	|'1900-01-01'				|限制选择器选择的最小时间	(只支持年限制),粒度格式和value格式要相符,否则会有错误提示|
+|end		|String	|'2200-12-01'				|限制选择器选择的最大时间(只支持年限制),粒度格式和value格式要相符,否则会有错误提示|
+|value		|Array	|''	                        |当前日期选择器显示的时间	,粒度格式和value格式要相符,否则会又错误提示|
+|fields		|String	|'day'	               		|当前日期选择器粒度:year/month/day|
+
+
+**value 值说明:**
+
+|值 		|类型	|说明					|
+|---		|----	|---					|
+|[]			|Array	|当前日期选择器为开始时间的默认值			|
+|['1900-01-01']	|Array	|当前日期选择器开始时间为1900-01-01			|
+|['1900-01-01','2010-12-01'] |Array	|当前日期选择器开始时间为1900-01-01,结束时间为2010-12-01|
+
+**事件说明:**
+
+|事件名称	|说明		|
+|---|---|
+|showchange	|必传,用于控制显示隐藏|
+|change	|时间选择器点击【确定】按钮时时触发的事件,参数为选择器的当前的 value|
+|cancel	|时间选择器点击【取消】按钮时时触发的事件|
+
+**showchange事件说明:**
+
+showchange(){
+	this.isShow=!this.isShow;
+}
+
+**更新记录:**
+
+1.0.5:修复月份切换时,day存在显示undefined的问题;修复小程序value设置后滚动位置不对的问题</br>
+
+1.0.4:修复滚动穿透;修改默认fields为day,添加了同年限制月份(start和end同年,有月份限制),改正作者名与组件名字</br>
+
+1.0.3:修复动态的value不能赋值问题;修复end值的可选值与实际填入的end值小一年问题</br>
+
+1.0.2:优化了开始日期和结束日期的切换,当前版本切换时会显示更合适的日期;添加了粒度选择,现支持year/month/day;修复了demo的getDate -60年的获取问题</br>
+		
+1.0.1:新增组件——日期区间选择器
+
+**感谢:**
+
+> 有更多优化建议和需求,请联系作者panyh。谢谢!

+ 1 - 1
ghsApp/src/manifest.json

@@ -83,7 +83,7 @@
     "quickapp" : {},
     "quickapp" : {},
     /* 小程序特有相关 */
     /* 小程序特有相关 */
     "mp-weixin" : {
     "mp-weixin" : {
-        "appid" : "wxe4675bab299a52f7",
+        "appid" : "wx21b7c3ef12082099",
         "setting" : {
         "setting" : {
             "urlCheck" : false
             "urlCheck" : false
         },
         },

+ 11 - 3
ghsApp/src/store/modules/login.js

@@ -1,16 +1,24 @@
 export default {
 export default {
 	state: {
 	state: {
-		loginInfo: {}
+		loginInfo: {},
+		dictionariesInfo:{}
 	},
 	},
 	getters: {
 	getters: {
 		getLoginInfo(state) {
 		getLoginInfo(state) {
 			return state.loginInfo || {}
 			return state.loginInfo || {}
-		}
+		},
+		getDictionariesInfo(state) {
+			return state.dictionariesInfo || {}
+		},
 	},
 	},
 	mutations: {
 	mutations: {
 		setLoginInfo(state, payload) {
 		setLoginInfo(state, payload) {
 			state.loginInfo = payload
 			state.loginInfo = payload
-		}
+		},
+		setDictionariesInfo(state, payload) {
+			console.log('payload',payload)
+			state.dictionariesInfo = payload
+		},
 	}
 	}
 	// ,
 	// ,
 	// actions: {
 	// actions: {

+ 11 - 3
ghsApp/src/utils/auth.js

@@ -12,7 +12,7 @@ import {
 	getShopUserApi
 	getShopUserApi
 	// checkLogin,
 	// checkLogin,
 } from '@/api/common'
 } from '@/api/common'
-import { postWxCode } from '@/api/mini'
+import { postWxCode,getDictionaries } from '@/api/mini'
 
 
 import util from './util'
 import util from './util'
 /**
 /**
@@ -77,7 +77,6 @@ export async function getSelfInfo(update) {
  * @parmas update为true时会重新触发请求,重置vuex的数据
  * @parmas update为true时会重新触发请求,重置vuex的数据
  */
  */
 export async function wxLoginFn(update) {
 export async function wxLoginFn(update) {
-	
 	let dataInfo = null
 	let dataInfo = null
 	let loginInfo = store.state.login.loginInfo
 	let loginInfo = store.state.login.loginInfo
 	if (!util.isEmpty(loginInfo) && !update) {
 	if (!util.isEmpty(loginInfo) && !update) {
@@ -87,18 +86,27 @@ export async function wxLoginFn(update) {
 		uni.login({
 		uni.login({
 			provider: 'weixin',
 			provider: 'weixin',
 			success: res => {
 			success: res => {
+				console.log('res',res)
 				uni.setStorageSync('code', res.code)
 				uni.setStorageSync('code', res.code)
 				postWxCode({ code: res.code }).then(subRes => {
 				postWxCode({ code: res.code }).then(subRes => {
 					if (util.isEmpty(subRes)) {
 					if (util.isEmpty(subRes)) {
 						return false
 						return false
 					}
 					}
-
 					var pages = getCurrentPages();
 					var pages = getCurrentPages();
 					var page = (pages[pages.length - 1]).route;
 					var page = (pages[pages.length - 1]).route;
 					resolve({ redirectPage: page, ...subRes })
 					resolve({ redirectPage: page, ...subRes })
 
 
 					uni.setStorageSync('token', subRes.data.token)
 					uni.setStorageSync('token', subRes.data.token)
 					uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
 					uni.setStorageSync('shopId', subRes.data.admin.currentShopId)
+					getDictionaries({ token: subRes.data.token }).then(res => {
+								if (util.isEmpty(res)) {
+									return false
+								}
+								store.commit('setDictionariesInfo', {
+									...res.data.dict,
+									...res.data
+								})
+						})
 					store.commit('setLoginInfo', {
 					store.commit('setLoginInfo', {
 						...subRes.data.admin,
 						...subRes.data.admin,
 						...subRes.data
 						...subRes.data