Commit 904236b3ff2217248dae5857ca68f4a513281e5f

Authored by 史婷婷
1 parent 5cd651ad

feat: 订货单-编辑&审核-产品-发货日期 控制选择范围 得大于 订货日期

... ... @@ -600,22 +600,16 @@
600 600 "navigationBarBackgroundColor": "#ffffff",
601 601 "navigationBarTextStyle": "black"
602 602 }
603   - }, {
  603 + },
  604 + {
604 605 "path": "pages/message/index",
605 606 "style": {
606 607 "navigationBarTitleText": "消息列表",
607 608 "navigationBarBackgroundColor": "#ffffff",
608 609 "navigationBarTextStyle": "black"
609 610 }
610   - }, {
611   - "path": "pages/message/detail",
612   - "style": {
613   - "navigationBarTitleText": "消息详情",
614   - "navigationBarBackgroundColor": "#ffffff",
615   - "navigationBarTextStyle": "black"
616   - }
617 611 }
618   - ],
  612 + ],
619 613 "subPackages": [
620 614 {
621 615 "root": "pages-business",
... ...
... ... @@ -44,7 +44,7 @@
44 44
45 45 <!-- 产品 -->
46 46 <view class="section2">
47   - <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" />
  47 + <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" :orderDate="form.orderDate" />
48 48 </view>
49 49
50 50 <view class="section">
... ...
... ... @@ -43,7 +43,7 @@
43 43
44 44 <!-- 产品 -->
45 45 <view class="section2">
46   - <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" :pageType="'modify'" />
  46 + <Product mode="add" :list="initPurchaseOrderLineList" @change="purchaseOrderLineListChange" :pageType="'modify'" :orderDate="form.orderDate" />
47 47 </view>
48 48
49 49 <view class="section">
... ...
... ... @@ -53,10 +53,10 @@
53 53 class="label">销售价格</text><text class="value">{{
54 54 item.salesPrice }}</text></view>
55 55
56   - <uni-list class="edit-list">
  56 + <uni-list class="edit-list">
57 57 <uni-list-item title="发货日期">
58 58 <template v-slot:footer>
59   - <uni-datetime-picker type="date" v-model="item.deliveryDate" />
  59 + <uni-datetime-picker type="date" v-model="item.deliveryDate" :start="minDeliveryDate" @change="onDeliveryChange($event, item, idx)" />
60 60 </template>
61 61 </uni-list-item>
62 62 <uni-list-item title="考核超协">
... ... @@ -137,7 +137,8 @@ export default {
137 137 list: { type: Array, default: () => [] },
138 138 max: { type: Number, default: 8 },
139 139 totalQuantity: { type: Number, default: 0 },
140   - pageType: { type: String, default: '' }
  140 + pageType: { type: String, default: '' },
  141 + orderDate: { type: String, default: '' }
141 142 },
142 143 data() {
143 144 return {
... ... @@ -146,6 +147,21 @@ export default {
146 147 }
147 148 },
148 149 computed: {
  150 + minDeliveryDate() {
  151 + const s = this.orderDate
  152 + if (!s) return ''
  153 + const parts = String(s).split('-')
  154 + const y = Number(parts[0])
  155 + const m = Number(parts[1])
  156 + const d = Number(parts[2])
  157 + if (!y || !m || !d) return ''
  158 + const dt = new Date(y, m - 1, d)
  159 + dt.setDate(dt.getDate() + 1)
  160 + const yy = dt.getFullYear()
  161 + const mm = String(dt.getMonth() + 1).padStart(2, '0')
  162 + const dd = String(dt.getDate()).padStart(2, '0')
  163 + return `${yy}/${mm}/${dd}`
  164 + }
149 165 },
150 166 watch: {
151 167 items: {
... ... @@ -185,6 +201,29 @@ export default {
185 201 },
186 202 toggleViewCollapse() {
187 203 this.collapsedView = !this.collapsedView
  204 + },
  205 + onDeliveryChange(e, item, idx) {
  206 + const getStr = (x) => {
  207 + if (x && x.detail && x.detail.value !== undefined) return x.detail.value
  208 + if (typeof x === 'string') return x
  209 + return item && item.deliveryDate ? item.deliveryDate : ''
  210 + }
  211 + const val = getStr(e)
  212 + if (!val || !this.orderDate) return
  213 + const parse = (s) => {
  214 + const p = String(s).replace(/\//g, '-').split('-')
  215 + const y = Number(p[0])
  216 + const m = Number(p[1])
  217 + const d = Number(p[2])
  218 + return new Date(y, m - 1, d)
  219 + }
  220 + const sel = parse(val)
  221 + const ord = parse(this.orderDate)
  222 + if (!(sel > ord)) {
  223 + item.deliveryDate = ''
  224 + this.$set(this.items, idx, { ...item })
  225 + uni.showToast({ title: '发货日期必须大于订货日期', icon: 'none' })
  226 + }
188 227 }
189 228 }
190 229 }
... ...