Commit 025d36964ee47d85d909225279ee1f7133f8217a

Authored by 史婷婷
1 parent 5009fe13

feat: 订货单-申请发货

@@ -173,25 +173,33 @@ @@ -173,25 +173,33 @@
173 } 173 }
174 }, 174 },
175 { 175 {
176 - "path": "pages/revoke_list/index", 176 + "path": "pages/order_list/modify",
177 "style": { 177 "style": {
178 - "navigationBarTitleText": "撤销单列表", 178 + "navigationBarTitleText": "编辑订货单",
179 "navigationBarBackgroundColor": "#ffffff", 179 "navigationBarBackgroundColor": "#ffffff",
180 "navigationBarTextStyle": "black" 180 "navigationBarTextStyle": "black"
181 } 181 }
182 }, 182 },
183 { 183 {
184 - "path": "pages/change_list/index", 184 + "path": "pages/order_list/shipment_apply",
185 "style": { 185 "style": {
186 - "navigationBarTitleText": "规格变更单", 186 + "navigationBarTitleText": "申请发货",
187 "navigationBarBackgroundColor": "#ffffff", 187 "navigationBarBackgroundColor": "#ffffff",
188 "navigationBarTextStyle": "black" 188 "navigationBarTextStyle": "black"
189 } 189 }
190 }, 190 },
191 { 191 {
192 - "path": "pages/order_list/modify", 192 + "path": "pages/revoke_list/index",
  193 + "style": {
  194 + "navigationBarTitleText": "撤销单列表",
  195 + "navigationBarBackgroundColor": "#ffffff",
  196 + "navigationBarTextStyle": "black"
  197 + }
  198 + },
  199 + {
  200 + "path": "pages/change_list/index",
193 "style": { 201 "style": {
194 - "navigationBarTitleText": "订货单编辑", 202 + "navigationBarTitleText": "规格变更单",
195 "navigationBarBackgroundColor": "#ffffff", 203 "navigationBarBackgroundColor": "#ffffff",
196 "navigationBarTextStyle": "black" 204 "navigationBarTextStyle": "black"
197 } 205 }
@@ -162,30 +162,35 @@ export default { @@ -162,30 +162,35 @@ export default {
162 return { 162 return {
163 id: '', 163 id: '',
164 form: { 164 form: {
165 - id: '',  
166 - orderNo: '',  
167 - supplyUnit: '',  
168 - orderingUnitName: '',  
169 - orderDate: '',  
170 - examineStatus: '',  
171 - workshopName: '',  
172 - settlementTerms: '',  
173 - deliveryMethod: '',  
174 - priceListNo: '',  
175 - invoicingStatus: '',  
176 - shippingCost: '',  
177 - packagingFee: '', 165 + code: '',
  166 + supplier: '',
  167 + buyer: '',
  168 + // 默认当前日期 格式为 yyyy-MM-dd
  169 + orderDate: new Date().toISOString().substring(0, 10),
  170 + unit: '',
  171 + totalQuantity: '',
  172 + totalAmountExcludingTax: '',
  173 + totalAmountIncludingTax: '',
  174 + totalAmountCapital: '',
  175 + depositInfo: '',
  176 + packagingRequirements: '',
  177 + paymentTerms: '',
  178 + transportMode: '',
  179 + destinationId: [],
  180 + includesPackagingFee: '',
  181 + includesTransportFee: '',
  182 + designatedConsignee: '',
  183 + specialTerms: '',
178 executionStandard: '', 184 executionStandard: '',
179 - executionStandardName: '',  
180 - pieceWeightHeader: '', 185 + executionStandardRemarks: '',
  186 + specialInstructions: '',
  187 + remarks: '',
  188 + pieceWeightHead: '',
181 surface: '', 189 surface: '',
182 tolerance: '', 190 tolerance: '',
183 performance: '', 191 performance: '',
184 - element: '', 192 + component: '',
185 packaging: '', 193 packaging: '',
186 - remarks: '',  
187 - purchaseOrderLineList: [],  
188 - totalQuantity: 0,  
189 }, 194 },
190 initPurchaseOrderLineList: [], 195 initPurchaseOrderLineList: [],
191 dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [], AUDIT_STATUS: [] }, 196 dicOptions: { SUPPLIER: [], APPLICABLE_STANDARD: [], AUDIT_STATUS: [] },
@@ -22,9 +22,10 @@ @@ -22,9 +22,10 @@
22 <view class="row"><text class="label">牌号</text><text class="value">{{ item.brand }}</text></view> 22 <view class="row"><text class="label">牌号</text><text class="value">{{ item.brand }}</text></view>
23 23
24 <view v-show="!item.collapsed"> 24 <view v-show="!item.collapsed">
  25 + <!-- 厚(公差) * 宽(公差) * 长(公差) -->
25 <view class="row row-spec"><text class="label">规格(mm)</text> 26 <view class="row row-spec"><text class="label">规格(mm)</text>
26 <view class="value value-spec"> 27 <view class="value value-spec">
27 - <view class="value-spec_val">{{ item.thickness }}</view> 28 + <view v-if="item.thickness" class="value-spec_val">{{ item.thickness }}</view>
28 <view class="value-spec_box"> 29 <view class="value-spec_box">
29 <view class="value-spec_box_1">+{{ item.thicknessTolPos }}</view> 30 <view class="value-spec_box_1">+{{ item.thicknessTolPos }}</view>
30 <view class="value-spec_box_2">-{{ item.thicknessTolNeg }}</view> 31 <view class="value-spec_box_2">-{{ item.thicknessTolNeg }}</view>
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <uni-list>
  5 + <view class="section">
  6 + <uni-list-item title="订单编号">
  7 + <template v-slot:footer>
  8 + <view class="readonly-text">{{ form.orderNo }}</view>
  9 + </template>
  10 + </uni-list-item>
  11 + <uni-list-item title="客户名称">
  12 + <template v-slot:footer>
  13 + <view class="readonly-text">{{ form.orderingUnitName }}</view>
  14 + </template>
  15 + </uni-list-item>
  16 + <uni-list-item title="办事处">
  17 + <template v-slot:footer>
  18 + <view class="readonly-text">{{ form.deptName }}</view>
  19 + </template>
  20 + </uni-list-item>
  21 + <uni-list-item title="生产厂">
  22 + <template v-slot:footer>
  23 + <view class="readonly-text">{{ form.workshopName }}</view>
  24 + </template>
  25 + </uni-list-item>
  26 + <uni-list-item title="计划吨位(t)">
  27 + <template v-slot:footer>
  28 + <view class="readonly-text">{{ form.quantity }}</view>
  29 + </template>
  30 + </uni-list-item>
  31 + <uni-list-item title="计划装货日期">
  32 + <template v-slot:footer>
  33 + <view class="readonly-text">{{ form.deliveryDate }}</view>
  34 + </template>
  35 + </uni-list-item>
  36 + </view>
  37 +
  38 + <view class="section">
  39 +
  40 + <uni-list-item>
  41 + <template v-slot:body>
  42 + <view class="item-title"><text class="required">*</text><text>卸货地点</text></view>
  43 + </template>
  44 + <template v-slot:footer>
  45 + <uni-easyinput v-model="form.destination" placeholder="请输入卸货地点" :inputBorder="false" />
  46 + </template>
  47 + </uni-list-item>
  48 + <uni-list-item>
  49 + <template v-slot:body>
  50 + <view class="item-title"><text class="required">*</text><text>接货人/联络人</text></view>
  51 + </template>
  52 + <template v-slot:footer>
  53 + <uni-easyinput v-model="form.consignee" placeholder="请输入接货人/联络人" :inputBorder="false" />
  54 + </template>
  55 + </uni-list-item>
  56 + <uni-list-item>
  57 + <template v-slot:body>
  58 + <view class="item-title"><text class="required">*</text><text>联系电话</text></view>
  59 + </template>
  60 + <template v-slot:footer>
  61 + <uni-easyinput v-model="form.phone" placeholder="请输入联系电话" :inputBorder="false" />
  62 + </template>
  63 + </uni-list-item>
  64 +
  65 + </view>
  66 +
  67 + <view class="section">
  68 + <uni-list-item title="回货计划安排">
  69 + <template v-slot:footer>
  70 + <uni-easyinput type="textarea" v-model="form.returnPlanArrangement" placeholder="请输入回货计划安排"
  71 + :inputBorder="false" />
  72 + </template>
  73 + </uni-list-item>
  74 + <uni-list-item title="特殊需求、其他等">
  75 + <template v-slot:footer>
  76 + <uni-easyinput type="textarea" v-model="form.other" placeholder="请输入特殊需求、其他等"
  77 + :inputBorder="false" />
  78 + </template>
  79 + </uni-list-item>
  80 + <uni-list-item title="装货特别要求/需求">
  81 + <template v-slot:footer>
  82 + <uni-easyinput type="textarea" v-model="form.specialLoadingRequirement"
  83 + placeholder="请输入装货特别要求/需求" :inputBorder="false" />
  84 + </template>
  85 + </uni-list-item>
  86 + </view>
  87 + </uni-list>
  88 + </scroll-view>
  89 +
  90 + <view class="footer">
  91 + <button class="btn submit" type="primary" @click="onSubmit">提交</button>
  92 + </view>
  93 + </view>
  94 +</template>
  95 +
  96 +<script>
  97 +import { getDetailApi } from '@/api/order_list.js'
  98 +import { createApi as createShipmentApplyApi } from '@/api/draft_order.js'
  99 +
  100 +export default {
  101 + name: 'ShipmentApply',
  102 + data() {
  103 + return {
  104 + id: '',
  105 + form: {
  106 + orderNo: '',
  107 + orderingUnitName: '',
  108 + deptName: '',
  109 + workshopName: '',
  110 + quantity: '',
  111 + deliveryDate: '',
  112 + destination: '',
  113 + consignee: '',
  114 + phone: '',
  115 + returnPlanArrangement: '',
  116 + other: '',
  117 + specialLoadingRequirement: '',
  118 + },
  119 + }
  120 + },
  121 + onLoad(query) {
  122 + this.id = (query && (query.id || query.code)) || ''
  123 + if (this.id) this.loadDetail(this.id)
  124 + },
  125 + methods: {
  126 + async loadDetail(id) {
  127 + try {
  128 + const res = await getDetailApi(id)
  129 + const m = res.data || {}
  130 + const response = { ...this.form, ...m }
  131 + response.id = m.id || m.code || id
  132 + this.form = {
  133 + purchaseOrderId: response.id || '',
  134 + orderNo: response?.orderNo || '',
  135 + orderingUnit: response?.orderingUnit || '',
  136 + orderingUnitName: response?.orderingUnitName || '',
  137 + deptName: response?.deptName || '',
  138 + deptId: response?.deptId || '',
  139 + workshopName: response?.workshopName || '',
  140 + workshopId: response?.workshopId || '',
  141 + quantity: response?.totalQuantity / 1000 || '',
  142 + deliveryDate: response?.deliveryDate || '',
  143 + destination: response?.destination || '',
  144 + consignee: response?.consignee || '',
  145 + phone: response?.phone || '',
  146 + returnPlanArrangement: response?.returnPlanArrangement || '',
  147 + other: response?.other || '',
  148 + specialLoadingRequirement: response?.specialLoadingRequirement || '',
  149 + };
  150 + } catch (e) {
  151 + uni.showToast({ title: '加载失败', icon: 'none' })
  152 + }
  153 + },
  154 + validateRequired() {
  155 + const checks = [
  156 + { key: 'destination', label: '卸货地点' },
  157 + { key: 'consignee', label: '接货人/联络人' },
  158 + { key: 'phone', label: '联系电话' },
  159 + ]
  160 + for (const it of checks) {
  161 + const val = this.form[it.key]
  162 + if (val === undefined || val === null || String(val).trim() === '') {
  163 + uni.showToast({ title: `请先填写${it.label}`, icon: 'none' })
  164 + return false
  165 + }
  166 + }
  167 + return true
  168 + },
  169 + async onSubmit() {
  170 + if (!this.validateRequired()) return
  171 + const payload = { ...this.form }
  172 + console.log('onSubmit__payload', payload)
  173 + try {
  174 + await createShipmentApplyApi(payload)
  175 + uni.showToast({ title: '保存成功', icon: 'success' })
  176 + setTimeout(() => { uni.redirectTo({ url: '/pages/order_list/index' }) }, 300)
  177 + } catch (e) {
  178 + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
  179 + }
  180 + },
  181 + }
  182 +}
  183 +</script>
  184 +
  185 +<style lang="scss" scoped>
  186 +.page {
  187 + display: flex;
  188 + flex-direction: column;
  189 + height: 100%;
  190 +}
  191 +
  192 +.scroll {
  193 + flex: 1;
  194 + padding: 6rpx 0 156rpx;
  195 +}
  196 +
  197 +
  198 +.section {
  199 + background: #fff;
  200 + margin-bottom: 20rpx;
  201 +}
  202 +
  203 +.section2 {
  204 + background: #f1f1f1;
  205 +}
  206 +
  207 +::v-deep .uni-list {
  208 + background: transparent;
  209 +
  210 + &-item {
  211 + &__extra-text {
  212 + font-size: 32rpx;
  213 + }
  214 +
  215 + &__content-title {
  216 + font-size: 32rpx;
  217 + color: rgba(0, 0, 0, 0.9);
  218 + }
  219 +
  220 + &__container {
  221 + padding: 32rpx;
  222 + align-items: center;
  223 +
  224 + .uni-easyinput {
  225 +
  226 + .is-disabled {
  227 + background-color: transparent !important;
  228 + }
  229 +
  230 + &__placeholder-class {
  231 + font-size: 32rpx;
  232 + color: rgba(0, 0, 0, 0.4);
  233 + }
  234 +
  235 + &__content {
  236 + border: none;
  237 +
  238 + &-input {
  239 + padding-left: 0 !important;
  240 + height: 48rpx;
  241 + line-height: 48rpx;
  242 + font-size: 32rpx;
  243 + }
  244 +
  245 + .content-clear-icon {
  246 + font-size: 44rpx !important;
  247 + }
  248 + }
  249 + }
  250 +
  251 + .amount-row {
  252 + flex: 1;
  253 + display: flex;
  254 + align-items: center;
  255 +
  256 + .uni-easyinput {
  257 + flex: 1;
  258 + }
  259 +
  260 + .unit {
  261 + margin-left: 16rpx;
  262 + color: rgba(0, 0, 0, 0.9);
  263 + }
  264 + }
  265 +
  266 + .item-title,
  267 + .uni-list-item__content {
  268 + flex: none;
  269 + min-height: 48rpx;
  270 + line-height: 48rpx;
  271 + font-size: 32rpx;
  272 + position: relative;
  273 + width: 162rpx;
  274 + margin-right: 32rpx;
  275 + color: rgba(0, 0, 0, 0.9);
  276 + padding-right: 0;
  277 +
  278 +
  279 + .required {
  280 + color: red;
  281 + position: absolute;
  282 + top: 50%;
  283 + transform: translateY(-50%);
  284 + left: -16rpx;
  285 + }
  286 + }
  287 +
  288 + }
  289 +
  290 + &.select-item {
  291 + &.is-empty {
  292 + .uni-list-item__extra-text {
  293 + color: rgba(0, 0, 0, 0.4) !important;
  294 + }
  295 + }
  296 +
  297 + &.is-filled {
  298 + .uni-list-item__extra-text {
  299 + color: rgba(0, 0, 0, 0.9) !important;
  300 + }
  301 + }
  302 +
  303 + .serial-number-row {
  304 + display: flex;
  305 + align-items: center;
  306 + }
  307 +
  308 + }
  309 +
  310 + &.mgb10 {
  311 + margin-bottom: 20rpx;
  312 + }
  313 +
  314 + }
  315 +
  316 +}
  317 +
  318 +/* 只读 easyinput 根据内容自适应高度 */
  319 +::v-deep .uni-list-item__container {
  320 + align-items: flex-start;
  321 +}
  322 +
  323 +/* 只读文本样式 */
  324 +.readonly-text {
  325 + color: rgba(0, 0, 0, 0.9);
  326 + font-size: 32rpx;
  327 + line-height: 44rpx;
  328 + text-align: right;
  329 + white-space: pre-wrap;
  330 + word-break: break-all;
  331 +}
  332 +
  333 +
  334 +.footer {
  335 + position: fixed;
  336 + left: 0;
  337 + right: 0;
  338 + bottom: 0;
  339 + padding: 32rpx;
  340 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  341 + background: #fff;
  342 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  343 +
  344 + .btn {
  345 + height: 80rpx;
  346 + line-height: 80rpx;
  347 + border-radius: 12rpx;
  348 + font-size: 32rpx;
  349 + }
  350 +
  351 + .submit {
  352 + background: $theme-primary;
  353 + color: #fff;
  354 + }
  355 +
  356 +}
  357 +</style>