lilei %!s(int64=3) %!d(string=hai) anos
pai
achega
4d774d385e
Modificáronse 4 ficheiros con 42 adicións e 32 borrados
  1. 3 14
      api/data.js
  2. 24 0
      pages/sales/index.vue
  3. 14 18
      pages/sales/salesSearch.vue
  4. 1 0
      store/index.js

+ 3 - 14
api/data.js

@@ -1,11 +1,5 @@
 import axios from '@/libs/axios.js';
 // 根据字典code查询选项
-// export const getLookUpDatas = (params) => {
-//   return axios.request({
-//     url: `lookup/findByLookup/${params.type}`,
-//     method: 'get'
-//   })
-// }
 export const getLookUpDatas = (params) => {
   const url = `lookupItem/query/${params.pageNo}/${params.pageSize}`
   delete params.pageNo
@@ -16,20 +10,15 @@ export const getLookUpDatas = (params) => {
     method: 'post'
   })
 }
+
 export const listLookUp = (params) => {
-  const url = `/lookup/queryLike`
+  const url = `lookup/queryLike`
   return axios.request({
     url: url,
     method: 'POST'
   }).then(res => res)
 }
-// export const listLookUp = (params) => {
-//   let url = `lookup/findAll`
-//   return axios.request({
-//     url: url,
-//     method: 'post'
-//   }).then(res => res)
-// }
+ 
 // 查询最新版本信息
 export const getSysVersion = (params) => {
   return axios.request({

+ 24 - 0
pages/sales/index.vue

@@ -56,6 +56,7 @@
 	import ListComponent from './listComponent.vue'
 	import { toThousands } from '@/libs/tools'
 	import { bizData } from '@/api/sales'
+	import { listLookUp, getLookUpDatas } from '@/api/data.js'
 	export default{
 		components: { ListComponent },
 		data(){
@@ -116,6 +117,11 @@
 				console.log(res)
 			  }
 			})
+			
+			// 获取数据字典
+			this.getListLookUp();
+			// 获取支付,收款方式
+			this.getLookUpList('SETTLE_STYLE', 'vuex_paymentTypeList');
 		},
 		onUnload() {
 			uni.$off('refreshSalesHomeBL')
@@ -125,6 +131,24 @@
 			this.getBizData()
 		},
 		methods:{
+			//  获取数据字典
+			getListLookUp() {
+				const _this = this;
+				listLookUp().then(res => {
+					if (res.status == 200) {
+						_this.$store.state.vuex_allLookUp = res.data;
+					}
+				});
+			},
+			// 或某一项字典列表,参数code
+			getLookUpList(code, vuexKey) {
+				getLookUpDatas({ pageNo: 1,pageSize: 1000, lookupCode: code}).then(res => {
+					console.log(res)
+					if (res.status == 200) {
+						this.$store.state[vuexKey] = res.data.list || [];
+					}
+				});
+			},
 			seleteTime(val){
 				this.navInd = val
 			},

+ 14 - 18
pages/sales/salesSearch.vue

@@ -28,7 +28,7 @@
 		<!-- 选择日期范围 -->
 		<u-calendar v-model="showDate" @change="dateChange" mode="range"></u-calendar>
 		<!-- 选择收款方式 -->
-		<u-picker v-model="settleStyleModal" @confirm="settleStyleChange" :range="settleStyleList" range-key="name" mode="selector"></u-picker>
+		<u-picker v-model="settleStyleModal" @confirm="settleStyleChange" :range="settleStyleList" range-key="dispName" mode="selector"></u-picker>
 	</view>
 </template>
 
@@ -76,7 +76,6 @@
 		},
 		mounted() {
 			this.init()
-			this.getTypeList()
 		},
 		methods: {
 			//  初始化数据
@@ -117,26 +116,21 @@
 			},
 			// 收款方式  change
 			settleStyleChange(ind){
-				this.form.settleStyleSn = this.settleStyleList[ind].settleStyleSn || undefined
-				this.settleStyleName = this.settleStyleList[ind].name || ''
+				this.form.settleStyleSn = this.settleStyleList[ind].code || undefined
+				this.settleStyleName = this.settleStyleList[ind].dispName || ''
 			},
 			// 收款方式
 			getTypeList () {
-				settleStyleQueryAll({}).then(res => {
-					if (res.status == 200 && res.data) {
-						this.settleStyleList = res.data
-						// 收款方式有值时,匹配对应name
-						if(this.defaultParams.settleStyleSn || this.defaultParams.settleStyleSn==0){
-							this.settleStyleList.map(item => {
-								if(item.settleStyleSn == this.defaultParams.settleStyleSn){
-									this.settleStyleName = item.name
-								}
-							})
+				this.settleStyleList = this.$store.state.vuex_paymentTypeList
+				console.log(this.settleStyleList)
+				// 收款方式有值时,匹配对应name
+				if(this.defaultParams.settleStyleSn || this.defaultParams.settleStyleSn==0){
+					this.settleStyleList.map(item => {
+						if(item.code == this.defaultParams.settleStyleSn){
+							this.settleStyleName = item.dispName
 						}
-					} else {
-						this.settleStyleList = []
-					}
-				})
+					})
+				}
 			},
 			// 时间  change
 			dateChange(date){
@@ -160,6 +154,8 @@
 			isShow (newValue, oldValue) {
 				if (!newValue) {
 					this.$emit('close')
+				}else{
+					this.getTypeList()
 				}
 			}
 		}

+ 1 - 0
store/index.js

@@ -107,6 +107,7 @@ const store = new Vuex.Store({
 		vuex_lastBuleDevice: null,
 		vuex_OrderAddress: {}, // 地址
 		vuex_allLookUp: [],  //  数据字典
+		vuex_paymentTypeList: [], // 收款方式
 	},
 	mutations: {
 		$uStore(state, payload) {