Commit e190552ee65dc98e7d0fb8b7633926761a8b9a5b

Authored by 史婷婷
1 parent d18d6a53

feat: 草稿要车单-编辑

... ... @@ -682,6 +682,14 @@
682 682 }
683 683 },
684 684 {
  685 + "path": "pages/draft_order/modify",
  686 + "style": {
  687 + "navigationBarTitleText": "编辑草稿要车单",
  688 + "navigationBarBackgroundColor": "#ffffff",
  689 + "navigationBarTextStyle": "black"
  690 + }
  691 + },
  692 + {
685 693 "path": "pages/car_request_order/index",
686 694 "style": {
687 695 "navigationBarTitleText": "要车单",
... ...
  1 +<template>
  2 + <view class="page">
  3 + <scroll-view class="scroll" scroll-y>
  4 + <uni-list>
  5 + <view class="section">
  6 + <!-- 编辑模式下,订单编号通常不允许修改,或者作为只读显示,但为了保持与新增页UI一致,这里保留结构但设为不可点击 -->
  7 + <uni-list-item class="select-item is-filled" :rightText="form.orderNo || ''">
  8 + <template v-slot:body>
  9 + <view class="item-title"><text class="required">*</text><text>订单编号</text></view>
  10 + </template>
  11 + </uni-list-item>
  12 + <uni-list-item title="客户名称">
  13 + <template v-slot:footer>
  14 + <view class="readonly-text">{{ form.orderingUnitName }}</view>
  15 + </template>
  16 + </uni-list-item>
  17 + <uni-list-item title="办事处">
  18 + <template v-slot:footer>
  19 + <view class="readonly-text">{{ form.deptName }}</view>
  20 + </template>
  21 + </uni-list-item>
  22 + <uni-list-item title="生产厂">
  23 + <template v-slot:footer>
  24 + <view class="readonly-text">{{ form.workshopName }}</view>
  25 + </template>
  26 + </uni-list-item>
  27 + <uni-list-item title="计划吨位(kg)">
  28 + <template v-slot:footer>
  29 + <view class="readonly-text">{{ form.quantity }}</view>
  30 + </template>
  31 + </uni-list-item>
  32 + <uni-list-item title="计划装货日期">
  33 + <template v-slot:footer>
  34 + <view class="readonly-text">{{ form.deliveryDate }}</view>
  35 + </template>
  36 + </uni-list-item>
  37 + </view>
  38 + <view class="section">
  39 + <uni-list-item title="卸货地点">
  40 + <template v-slot:footer>
  41 + <uni-easyinput v-model="form.destination" placeholder="请输入卸货地点" :inputBorder="false" />
  42 + </template>
  43 + </uni-list-item>
  44 + <uni-list-item title="接货人/联络人">
  45 + <template v-slot:footer>
  46 + <uni-easyinput v-model="form.consignee" placeholder="请输入接货人/联络人" :inputBorder="false" />
  47 + </template>
  48 + </uni-list-item>
  49 + <uni-list-item title="联系电话">
  50 + <template v-slot:footer>
  51 + <uni-easyinput v-model="form.phone" placeholder="请输入联系电话" :inputBorder="false" />
  52 + </template>
  53 + </uni-list-item>
  54 + <uni-list-item title="回货计划安排">
  55 + <template v-slot:footer>
  56 + <uni-easyinput type="textarea" v-model="form.returnPlanArrangement" placeholder="请输入回货计划安排" :inputBorder="false" />
  57 + </template>
  58 + </uni-list-item>
  59 + <uni-list-item title="特殊需求、其他等">
  60 + <template v-slot:footer>
  61 + <uni-easyinput type="textarea" v-model="form.other" placeholder="请输入特殊需求、其他等" :inputBorder="false" />
  62 + </template>
  63 + </uni-list-item>
  64 + <uni-list-item title="装货特别要求/需求">
  65 + <template v-slot:footer>
  66 + <uni-easyinput type="textarea" v-model="form.specialLoadingRequirement" placeholder="请输入装货特别要求/需求" :inputBorder="false" />
  67 + </template>
  68 + </uni-list-item>
  69 + </view>
  70 + </uni-list>
  71 + </scroll-view>
  72 +
  73 + <view class="footer">
  74 + <button class="btn submit" type="primary" @click="onSubmit">保存</button>
  75 + </view>
  76 + </view>
  77 +</template>
  78 +
  79 +<script>
  80 +import { updateApi, getDetailApi } from '@/api/draft_order.js'
  81 +
  82 +export default {
  83 + name: 'DraftOrderModify',
  84 + components: {},
  85 + data() {
  86 + return {
  87 + form: {
  88 + id: '',
  89 + orderNo: '',
  90 + orderingUnitName: '',
  91 + deptName: '',
  92 + workshopName: '',
  93 + quantity: '',
  94 + deliveryDate: '',
  95 + destination: '',
  96 + consignee: '',
  97 + phone: '',
  98 + returnPlanArrangement: '',
  99 + other: '',
  100 + specialLoadingRequirement: '',
  101 +
  102 + },
  103 + }
  104 + },
  105 + onLoad(query) {
  106 + const id = (query && (query.id || query.code)) || ''
  107 + if (id) {
  108 + this.loadDetail(id)
  109 + }
  110 + },
  111 + methods: {
  112 + async loadDetail(id) {
  113 + try {
  114 + const res = await getDetailApi(id)
  115 + const m = res.data || {}
  116 + const next = { ...this.form, ...m }
  117 + // 确保ID存在
  118 + next.id = m.id || id
  119 + this.form = next;
  120 + } catch (e) {
  121 + uni.showToast({ title: '加载失败', icon: 'none' })
  122 + }
  123 + },
  124 + async onSubmit() {
  125 + const payload = { ...this.form }
  126 + delete payload.status
  127 + console.log('onSubmit__payload', payload)
  128 + try {
  129 + await updateApi(payload)
  130 + uni.showToast({ title: '保存成功', icon: 'success' })
  131 + setTimeout(() => { uni.redirectTo({ url: '/pages/draft_order/index' }) }, 300)
  132 + } catch (e) {
  133 + uni.showToast({ title: (e && e.msg) || '保存失败', icon: 'none' })
  134 + }
  135 + },
  136 + }
  137 +}
  138 +</script>
  139 +
  140 +<style lang="scss" scoped>
  141 +.page {
  142 + display: flex;
  143 + flex-direction: column;
  144 + height: 100%;
  145 +}
  146 +
  147 +.scroll {
  148 + flex: 1;
  149 + padding: 6rpx 0 144rpx;
  150 +}
  151 +
  152 +
  153 +
  154 +.title-header {
  155 + background-color: #fff;
  156 + display: flex;
  157 + align-items: center;
  158 + padding: 32rpx 32rpx 22rpx;
  159 +
  160 + .title-header_icon {
  161 + width: 32rpx;
  162 + height: 28rpx;
  163 + margin-right: 16rpx;
  164 + }
  165 +
  166 + span {
  167 + color: rgba(0, 0, 0, 0.9);
  168 + font-size: 32rpx;
  169 + line-height: 44rpx;
  170 + font-weight: 600;
  171 + }
  172 +}
  173 +
  174 +
  175 +.section {
  176 + background: #fff;
  177 + margin-bottom: 20rpx;
  178 +}
  179 +
  180 +.section2 {
  181 + background: #f1f1f1;
  182 +}
  183 +
  184 +::v-deep .uni-list {
  185 + background: transparent;
  186 +
  187 + &-item {
  188 + &__extra-text {
  189 + font-size: 32rpx;
  190 + }
  191 +
  192 + &__content-title {
  193 + font-size: 32rpx;
  194 + color: rgba(0, 0, 0, 0.9);
  195 + }
  196 +
  197 + &__container {
  198 + padding: 32rpx;
  199 + // align-items: center;
  200 +
  201 + .uni-easyinput {
  202 +
  203 + .is-disabled {
  204 + background-color: transparent !important;
  205 + }
  206 +
  207 + &__placeholder-class {
  208 + font-size: 32rpx;
  209 + color: rgba(0, 0, 0, 0.4);
  210 + }
  211 +
  212 + &__content {
  213 + border: none;
  214 +
  215 + &-input {
  216 + padding-left: 0 !important;
  217 + height: 48rpx;
  218 + line-height: 48rpx;
  219 + font-size: 32rpx;
  220 + }
  221 +
  222 + .content-clear-icon {
  223 + font-size: 44rpx !important;
  224 + }
  225 + }
  226 + }
  227 +
  228 + .amount-row {
  229 + flex: 1;
  230 + display: flex;
  231 + align-items: center;
  232 +
  233 + .uni-easyinput {
  234 + flex: 1;
  235 + }
  236 +
  237 + .unit {
  238 + margin-left: 16rpx;
  239 + color: rgba(0, 0, 0, 0.9);
  240 + }
  241 + }
  242 +
  243 + .item-title,
  244 + .uni-list-item__content {
  245 + flex: none;
  246 + min-height: 48rpx;
  247 + line-height: 48rpx;
  248 + font-size: 32rpx;
  249 + position: relative;
  250 + width: 210rpx;
  251 + margin-right: 32rpx;
  252 + color: rgba(0, 0, 0, 0.9);
  253 + padding-right: 0;
  254 +
  255 +
  256 + .required {
  257 + color: red;
  258 + position: absolute;
  259 + top: 50%;
  260 + transform: translateY(-50%);
  261 + left: -16rpx;
  262 + }
  263 + }
  264 +
  265 + }
  266 +
  267 + &.select-item {
  268 + &.is-empty {
  269 + .uni-list-item__extra-text {
  270 + color: rgba(0, 0, 0, 0.4) !important;
  271 + }
  272 + }
  273 +
  274 + &.is-filled {
  275 + .uni-list-item__extra-text {
  276 + color: rgba(0, 0, 0, 0.9) !important;
  277 + }
  278 + }
  279 +
  280 + .serial-number-row {
  281 + display: flex;
  282 + align-items: center;
  283 + }
  284 +
  285 + }
  286 +
  287 + &.mgb10 {
  288 + margin-bottom: 20rpx;
  289 + }
  290 +
  291 + }
  292 +
  293 + .title-header {
  294 + background-color: #fff;
  295 + display: flex;
  296 + align-items: center;
  297 + padding: 32rpx 32rpx 22rpx;
  298 +
  299 + &_icon {
  300 + width: 32rpx;
  301 + height: 28rpx;
  302 + margin-right: 16rpx;
  303 + }
  304 +
  305 + span {
  306 + color: rgba(0, 0, 0, 0.9);
  307 + font-size: 32rpx;
  308 + line-height: 44rpx;
  309 + font-weight: 600;
  310 + }
  311 + }
  312 +}
  313 +
  314 +/* 只读 easyinput 根据内容自适应高度 */
  315 +::v-deep .uni-list-item__container {
  316 + align-items: flex-start;
  317 +}
  318 +
  319 +/* 只读文本样式 */
  320 +.readonly-text {
  321 + color: rgba(0, 0, 0, 0.9);
  322 + font-size: 32rpx;
  323 + line-height: 48rpx;
  324 + text-align: right;
  325 + white-space: pre-wrap;
  326 + word-break: break-all;
  327 +}
  328 +
  329 +
  330 +.footer {
  331 + position: fixed;
  332 + left: 0;
  333 + right: 0;
  334 + bottom: 0;
  335 + padding: 32rpx;
  336 + padding-bottom: calc(32rpx + env(safe-area-inset-bottom));
  337 + background: #fff;
  338 + box-shadow: 0 -8rpx 24rpx rgba(0, 0, 0, 0.06);
  339 + z-index: 10;
  340 +
  341 + .btn {
  342 + height: 80rpx;
  343 + line-height: 80rpx;
  344 + border-radius: 12rpx;
  345 + font-size: 32rpx;
  346 + }
  347 +
  348 + .submit {
  349 + background: $theme-primary;
  350 + color: #fff;
  351 + }
  352 +
  353 + .view-total {
  354 + padding: 20rpx 0;
  355 +
  356 + .head {
  357 + font-size: 32rpx;
  358 + font-weight: 600;
  359 + line-height: 50rpx;
  360 + color: rgba(0, 0, 0, 0.9);
  361 + padding-bottom: 16rpx;
  362 + margin-bottom: 24rpx;
  363 + border-bottom: 1px dashed #E7E7E7;
  364 + }
  365 +
  366 + .row {
  367 + display: flex;
  368 + margin-bottom: 24rpx;
  369 + line-height: 32rpx;
  370 +
  371 + .row2 {
  372 + width: 50%;
  373 + }
  374 +
  375 + .label {
  376 + width: 180rpx;
  377 + margin-right: 14rpx;
  378 + color: rgba(0, 0, 0, 0.6);
  379 + font-size: 28rpx;
  380 + }
  381 +
  382 + .value {
  383 + flex: 1;
  384 + color: rgba(0, 0, 0, 0.9);
  385 + font-size: 28rpx;
  386 + white-space: pre-wrap;
  387 + word-break: break-all;
  388 + }
  389 + }
  390 + }
  391 +}
  392 +</style>
\ No newline at end of file
... ...