shish 2 лет назад
Родитель
Сommit
e2cfb3b316

+ 36 - 18
ghsApp/src/pagesPurchase/jdSupplier.vue

@@ -11,8 +11,8 @@
   <view class="order-page">
     <view class="order_list" >
     <block>
-        <block v-if="!$util.isEmpty(supplierList)">
-          <view class="list_item" v-for="(item, index) in supplierList" :key="index" @click="goToCg(item)" >
+        <block v-if="!$util.isEmpty(list.data)">
+          <view class="list_item" v-for="(item, index) in list.data" :key="index" @click="goToCg(item)" >
 
             <view class="store_name">
               <image :src="item.avatar"></image>
@@ -40,7 +40,7 @@
           </view>
         </block>
         <block v-else>
-          <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(supplierList)" />
+          <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
         </block>
       </block>
     </view>
@@ -51,6 +51,7 @@
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { getList } from "@/api/ghs";
 import AppSearchModule from "@/components/module/app-search";
+import { list } from "@/mixins";
 export default {
   components: { AppWrapperEmpty, AppSearchModule },
   data () {
@@ -58,19 +59,26 @@ export default {
       list: {
         data: []
       },
-      supplierList: [],
-      tabIndex: 0
+      tabIndex: 0,
+      T:null,
+      search:''
     }
   },
-	onShow(){
-		uni.removeStorageSync('newGhs')
-    this.getGHSList('')
-	},
+  mixins: [list],
   onPullDownRefresh() {
-    this.getGHSList().then(res => {
+    this.getGhsList().then(res => {
       uni.stopPullDownRefresh();
     }) 
   },
+  onReachBottom() {
+    if (!this.list.finished) {
+      this.getGhsList().then((res) => {
+        uni.stopPullDownRefresh()
+      })
+    } else {
+      uni.stopPullDownRefresh();
+    }
+  },
   methods: {
 		addGhs(){
 			this.pageTo({url:'/pagesPurchase/suppAdd?location=0'})
@@ -78,18 +86,28 @@ export default {
     getDebtList(){
       this.$msg('开发中')
     },
-    settleAccounts (item) {
-      //this.pageTo({ url: '/pagesPurchase/gathering?id='+item.id})
-    },
     init() {
-      this.getGHSList('')
+      this.getGhsList()
     },
     searchFn(e) {
-      this.getGHSList(e)
+      let that = this
+      if(this.T != null){
+        clearTimeout(this.T)
+      }
+      this.T = setTimeout(function(){
+        that.resetList()
+        that.search = e
+        that.getGhsList()
+      },700)
     },
-    getGHSList (name) {
-      return getList({ pageSize:300, name:name,location:0 }).then(res => {
-        this.supplierList = res.data.list
+    getGhsList() {
+      let name = this.search
+      return getList({name:name,page: this.list.page}).then(res => {
+        this.info = res.data
+        this.completes(res);
+        if (this.$util.isEmpty(res.data)){
+          return false
+        }
       })
     },
     goToDebtList(item) {

+ 3 - 4
ghsApp/src/pagesPurchase/order.vue

@@ -24,7 +24,6 @@ import OrderItem from "./orderItem";
 import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { list } from "@/mixins";
 import { getPurchaseListApi,getLsRunningOrderNum } from "@/api/purchase";
-import { getWeixinId } from "@/api/invite";
 export default {
 	components: {
 		Tabs,
@@ -87,9 +86,9 @@ export default {
 		getCgList() {
 			let ghsId = this.option.ghsId || 0
 			let status = this.tabs[this.tabIndex].key
-			let options = { page: this.list.page, status: status, ghsId:ghsId,location:0 }
+			let options = {page:this.list.page,status:status,ghsId:ghsId}
 			return getPurchaseListApi(options) .then(res => {
-					this.completes(res);
+				this.completes(res);
 			})
 		},
 		changeTabEvent(info) {
@@ -102,7 +101,7 @@ export default {
 			this.getCgList();
 		},
 		addEvent() {
-			uni.navigateTo({ url: `/pagesPurchase/jdSupplier` })
+			uni.navigateTo({ url: `/pagesPurchase/supplier` })
 		},
 		gotoDetails(item) {
 			uni.navigateTo({ url: `/pagesPurchase/info?orderSn=${item.orderSn}` })

+ 2 - 2
ghsApp/src/pagesPurchase/suppAdd.vue

@@ -17,11 +17,11 @@
               </label>
               <label class="list" for="localLink">
                 <radio id="localLink" value="1" :checked="form.location == 1" style="transform:scale(0.7,0.7)" />
-                <span class="checkbox-text">本地</span>
+                <span class="checkbox-text">附近</span>
               </label>
             </radio-group>
           </tui-list-cell>
-          <view style="margin-top:20upx;padding:0 30upx 0 30upx;">选本地,录采购单,没有打包费、运费填写入口。选上游时,有打包费、运费的填写入口。</view>
+          <view style="margin-top:20upx;padding:0 30upx 0 30upx;">选附近,录采购单,没有打包费、运费填写入口。</view>
 
           <view style="margin-top:50upx;padding-left:50upx;font-size:38upx;margin-bottom:90upx;" v-if="!$util.isEmpty(supplierList)">
             <view v-for="(item, index) in supplierList" :key="index" @click="goToCg(item)" style="margin-bottom:30upx;">{{ item.name }}</view>

+ 31 - 26
ghsApp/src/pagesPurchase/supplier.vue

@@ -16,12 +16,12 @@
     <view class="order_list" >
     <view style="padding:22upx 0 0 20upx;font-size:30upx;">总欠款:{{info.totalDebtAmount?parseFloat(info.totalDebtAmount):0}}</view>
     <block>
-        <block v-if="!$util.isEmpty(supplierList)">
-          <view class="list_item" v-for="(item, index) in supplierList" :key="index" @click="goToCg(item)" >
+        <block v-if="!$util.isEmpty(list.data)">
+          <view class="list_item" v-for="(item, index) in list.data" :key="index" @click="goToCg(item)" >
 
             <view v-if="item.location == 1"
             style="width:90upx;padding:5upx 0 5upx 0;font-size:20upx;background-color:#7babc1;color:white;position:absolute;left:0;top:0;text-align:center;"
-            >本地</view>
+            >附近</view>
 
             <view class="store_name">
               <view class="store_title" @click.stop="nameModify(item)">
@@ -52,7 +52,7 @@
           </view>
         </block>
         <block v-else>
-          <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(supplierList)" />
+          <AppWrapperEmpty title="暂无数据" :is-empty="$util.isEmpty(list.data)" />
         </block>
       </block>
     </view>
@@ -78,6 +78,7 @@ import AppWrapperEmpty from "@/components/app-wrapper-empty";
 import { getList,changeGhsName } from "@/api/ghs";
 import AppSearchModule from "@/components/module/app-search";
 import ModalModule from "@/components/plugin/modal"
+import { list } from "@/mixins";
 export default {
   components: { AppWrapperEmpty, AppSearchModule,Tabs,ModalModule },
   data () {
@@ -88,7 +89,6 @@ export default {
       list: {
         data: []
       },
-      supplierList: [],
 			tabIndex: 0,
 			tabs: [
 				{
@@ -102,7 +102,7 @@ export default {
 					value: "0"
 				},
 				{
-					name: "本地",
+					name: "附近",
 					key: "1",
 					value: "0"
 				}
@@ -112,11 +112,21 @@ export default {
       T:null
     }
   },
+  mixins: [list],
   onPullDownRefresh() {
-    this.getGHSList().then(res => {
+    this.getGhsList().then(res => {
       uni.stopPullDownRefresh();
     }) 
   },
+  onReachBottom() {
+    if (!this.list.finished) {
+      this.getGhsList().then((res) => {
+        uni.stopPullDownRefresh()
+      })
+    } else {
+      uni.stopPullDownRefresh();
+    }
+  },
   methods: {
     modifyConfirm(val){
 			let that=this;
@@ -132,6 +142,7 @@ export default {
           that.modifyGhsId = 0
           that.modifyGhsName = ''
           that.modifyGhsShow = false
+          that.resetList()
           that.init()
         }
       })
@@ -142,11 +153,7 @@ export default {
       this.modifyGhsShow = true
     },
     cgList(item){
-      if(item.location && item.location == 1){
-        this.pageTo({url:'/pagesPurchase/wcOrder?ghsId='+item.id})
-      }else{
-        this.pageTo({url:'/pagesPurchase/order?ghsId='+item.id})
-      }
+      this.pageTo({url:'/pagesPurchase/order?ghsId='+item.id})
     },
 		changeTabEvent(info) {
 			const { index } = info;
@@ -154,7 +161,8 @@ export default {
 				return false;
 			} 
 			this.tabIndex = index;
-      this.getGHSList()
+      this.resetList()
+      this.getGhsList()
 		},
 		addGhs(){
 			this.pageTo({url:'/pagesPurchase/suppAdd'})
@@ -162,31 +170,28 @@ export default {
     getDebtList(){
       this.$msg('开发中')
     },
-    settleAccounts (item) {
-      //this.pageTo({ url: '/pagesPurchase/gathering?id='+item.id})
-    },
     init() {
-      this.getGHSList()
+      this.getGhsList()
     },
     searchFn(e) {
-      if (this.$util.isEmpty(e)){
-        return false
-      }
       let that = this
       if(this.T != null){
         clearTimeout(this.T)
       }
       this.T = setTimeout(function(){
+        that.resetList()
         that.search = e
-        that.getGHSList()
-      },500)
+        that.getGhsList()
+      },700)
     },
-    getGHSList() {
-      let location = this.tabs[this.tabIndex].key
+    getGhsList() {
       let name = this.search
-      return getList({ pageSize:300, name:name,location:location }).then(res => {
-        this.supplierList = res.data.list
+      return getList({name:name,page: this.list.page}).then(res => {
         this.info = res.data
+        this.completes(res);
+        if (this.$util.isEmpty(res.data)){
+          return false
+        }
       })
     },
     goToSearchDebt(item){