shish 1 dzień temu
rodzic
commit
b2041df55c

+ 3 - 2
hdApp/src/api/purchase/index.js

@@ -60,8 +60,9 @@ export const createPurchaseOrderApi = async data => {
 	return https.get("/ghs/list", data);
 };
 
-/** *
- * 采购记录
+/**
+ * 采购记录:searchTimeType 0 开单 addTime、1 账单 payTime、2 发货 sendTime。
+ * 对应 PurchaseController::actionList。
  */
  export const purchaseList = async data => {
 	return https.get("/purchase/list", data);

+ 2 - 2
hdApp/src/pagesPurchase/orderItem.vue

@@ -19,12 +19,12 @@
       <view class="item-info">
 
         <view class="info-row">
-          <text class="info-label"> 创建:</text>
+          <text class="info-label"> 开单:</text>
           <text class="info-value">{{ info.addTime ? info.addTime.substring(5, 16) : '' }}</text>
         </view>
 
         <view class="info-row" v-if="info.payTime!='0000-00-00 00:00:00'">
-          <text class="info-label"> 确认:</text>
+          <text class="info-label"> 账单:</text>
           <text class="info-value">{{ info.payTime ? info.payTime.substring(5, 16) : '' }}</text>
         </view>
 

+ 47 - 6
hdApp/src/pagesPurchase/shopping.vue

@@ -1,10 +1,26 @@
+<!--
+  花店采购记录列表:默认近 30 天、按开单时间 addTime 倒序。
+  筛选先选开单/发货/账单,再选日期范围;排序跟着当前类型走。
+-->
 <template>
   <view class="order-page">
     <view class="sticky-toolbar">
       <app-tabs :tabs="tabs" :isFixed="false" :currentTab="tabIndex" @change="change" itemWidth="20%" />
 
       <view class="filter-panel">
+        <!-- 先选按哪种时间,再选日期范围,读起来是:按开单 / 近30天 -->
         <view class="filter-row">
+          <view
+            v-for="item in timeTypeOptions"
+            :key="item.value"
+            class="filter-chip filter-chip--type"
+            :class="{ 'filter-chip--active': searchTimeType === item.value }"
+            @click="onSelectTimeType(item.value)"
+          >
+            <text class="filter-chip-text">{{ item.label }}</text>
+          </view>
+        </view>
+        <view class="filter-row filter-row--range">
           <view class="filter-chip filter-chip--date">
             <DateSelect
               ref="dateSelectRef"
@@ -103,7 +119,13 @@ export default {
 			startTime:'',
       endTime:'',
       ghsId:0,
-      ghsName:''
+      ghsName:'',
+      searchTimeType: 0,
+      timeTypeOptions: [
+        { label: '开单', value: 0 },
+        { label: '发货', value: 2 },
+        { label: '账单', value: 1 }
+      ]
     }
   },
   computed: {
@@ -148,10 +170,9 @@ export default {
       this.searchTime = 'last30Days'
       this.startTime = ''
       this.endTime = ''
-      if (this.$refs.dateSelectRef) {
-        this.$refs.dateSelectRef.defaultDateName = '近30天'
-        this.$refs.dateSelectRef.startDate = ''
-        this.$refs.dateSelectRef.endDate = ''
+      this.searchTimeType = 0
+      if (this.$refs.dateSelectRef && this.$refs.dateSelectRef.reset) {
+        this.$refs.dateSelectRef.reset()
       }
       this.resetList()
       this.getMyPurchase()      
@@ -162,6 +183,17 @@ export default {
 			this.endTime = val.endTime
       this.resetList()
       this.getMyPurchase()
+		},
+		/**
+		 * 切换开单 / 发货 / 账单时间筛选,列表排序跟着当前类型走。
+		 */
+		onSelectTimeType(type) {
+			if (this.searchTimeType === type) {
+				return
+			}
+			this.searchTimeType = type
+			this.resetList()
+			this.getMyPurchase()
 		},	
     change(e) {
       if (this.tabIndex != e.index) {
@@ -186,7 +218,7 @@ export default {
       this.getMyPurchase()
     },
     getMyPurchase () {
-      return purchaseList({ status: this.status,page: this.list.page,searchTime: this.searchTime,startTime: this.startTime,endTime: this.endTime,ghsId:this.ghsId}).then(res => {
+      return purchaseList({ status: this.status,page: this.list.page,searchTime: this.searchTime,startTime: this.startTime,endTime: this.endTime,ghsId:this.ghsId,searchTimeType: this.searchTimeType}).then(res => {
         this.completes(res)
         if (this.$util.isEmpty(res.data)){
           return false
@@ -243,6 +275,10 @@ export default {
   align-items: center;
 }
 
+.filter-row--range {
+  margin-top: 12upx;
+}
+
 .filter-chip {
   height: 68upx;
   padding: 0 22upx;
@@ -271,6 +307,11 @@ export default {
   justify-content: flex-start;
 }
 
+.filter-chip--type {
+  flex: 1;
+  min-width: 0;
+}
+
 .filter-chip--reset {
   min-width: 96upx;
   border-color: #d9dee8;