linwenxin 9 ماه پیش
والد
کامیت
fdc02b8b3e

+ 415 - 87
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/buttons/processFeedback.vue

@@ -1,11 +1,26 @@
 <template>
   <div class="withinLine">
     <el-button type="primary" size="mini" @click="open">{{ resultCodeName }}</el-button>
-    <el-dialog title="" width="750px" custom-class="diy-dialog" append-to-body :modal="true" :visible.sync="formDialog"
-      :show-close="true" :close-on-click-modal="false" :modal-append-to-body="false" :before-close="formCancel">
+    <el-dialog
+      title=""
+      width="750px"
+      custom-class="diy-dialog"
+      append-to-body
+      :modal="true"
+      :visible.sync="formDialog"
+      :show-close="true"
+      :close-on-click-modal="false"
+      :modal-append-to-body="false"
+      :before-close="formCancel"
+    >
       <zj-form-container v-if="formDialog" ref="formRef" :form-data="formData" :styleSwitch="false">
-        <zj-form-module :title="resultCodeName" label-width="140px" :showPackUp="false" :form-data="formData"
-          :form-items="formItems">
+        <zj-form-module
+          :title="resultCodeName"
+          label-width="140px"
+          :showPackUp="false"
+          :form-data="formData"
+          :form-items="formItems"
+        >
         </zj-form-module>
       </zj-form-container>
       <div slot="footer" class="dialog-footer">
@@ -20,7 +35,8 @@
 import buttonMixin from './button_mixin.js'
 import ImageUpload from '@/components/file-upload'
 import { required } from '@/components/template/rules_verify.js'
-import { orderBaseLogAdd } from "@/api/workOrderPool.js"
+import { orderBaseLogAdd } from '@/api/workOrderPool.js'
+import { serviceCategoryListMinus } from '@/api/recycleCategoryCenter.js'
 export default {
   mixins: [buttonMixin],
   components: {
@@ -41,16 +57,18 @@ export default {
       type: this.resultCode ? [this.resultCode] : ['其他', '预约', '改约', '异常反馈', '完工反馈', '回访'],
       formDialog: false,
       formData: {
-        "orderBaseId": this.orderInfo.id,
-        "imgSrc": [],
-        "content": "",
-        "appointmentTime": "",
-        "type": this.resultCode,
-        "typeText": this.resultCode
-      },
-      formRules: {
-
+        orderBaseId: this.orderInfo.id,
+        imgSrc: [],
+        content: '',
+        appointmentTime: '',
+        type: this.resultCode,
+        typeText: this.resultCode,
+        recycAmount: '',
+        payCertImg: []
       },
+      formRules: {},
+      serviceCategoryListMinusData: [],
+      huishouwangongList: []
     }
   },
   computed: {
@@ -59,101 +77,411 @@ export default {
       return JSON.parse(localStorage.getItem('greemall_user'))
     },
     formItems() {
-      return [{
-        md: 24,
-        name: 'el-radio',
-        options: this.type.map(item => ({ label: item, value: item })),
-        attributes: {},
-        formItemAttributes: {
-          label: '反馈结果',
-          prop: 'type',
-          rules: [...required]
-        },
-        event: {
-          change: (val) => {
-            this.formData.typeText = this.formData.type
+      return [
+        {
+          md: 24,
+          name: 'el-radio',
+          options: this.type.map(item => ({ label: item, value: item })),
+          attributes: {},
+          formItemAttributes: {
+            label: '反馈结果',
+            prop: 'type',
+            rules: [...required]
+          },
+          event: {
+            change: val => {
+              this.formData.typeText = this.formData.type
+            }
           }
-        }
-      }, {
-        name: 'el-date-picker',
-        md: 12,
-        isShow: !!~['预约', '改约'].indexOf(this.formData.type),
-        attributes: {
-          style: { width: '100%' },
-          placeholder: '请选择',
-          'value-format': 'yyyy-MM-dd HH:mm:ss',
-          'picker-options': {
-            disabledDate: time => {
-              return time.getTime() < (Date.now() - 86400000)
+        },
+        {
+          name: 'el-date-picker',
+          md: 12,
+          isShow: !!~['预约', '改约'].indexOf(this.formData.type),
+          attributes: {
+            style: { width: '100%' },
+            placeholder: '请选择',
+            'value-format': 'yyyy-MM-dd HH:mm:ss',
+            'picker-options': {
+              disabledDate: time => {
+                return time.getTime() < Date.now() - 86400000
+              }
             }
+          },
+          formItemAttributes: {
+            label: '预约日期',
+            prop: 'appointmentTime',
+            rules: [...required]
           }
         },
-        formItemAttributes: {
-          label: '预约日期',
-          prop: 'appointmentTime',
-          rules: [...required]
-        }
-      }, {
-        md: 24,
-        name: 'el-input',
-        attributes: { placeholder: '请输入', type: "textarea" },
-        formItemAttributes: {
-          label: '反馈内容',
-          prop: 'content',
-          rules: !~['预约', '改约', '完工反馈', '回访'].indexOf(this.formData.type) ? [...required] : []
-        }
-      }, {
-        md: 24,
-        name: 'slot-component',
-        formItemAttributes: {
-          label: '上传图片(最多6个)',
-          prop: 'imgSrc',
-          rules: []
+        {
+          md: 24,
+          isShow: !(['RECYCLE'].includes(this.orderType) && ['完工反馈'].includes(this.formData.type)),
+          name: 'el-input',
+          attributes: { placeholder: '请输入', type: 'textarea' },
+          formItemAttributes: {
+            label: '反馈内容',
+            prop: 'content',
+            rules: !~['预约', '改约', '完工反馈', '回访'].indexOf(this.formData.type) ? [...required] : []
+          }
+        },
+        {
+          md: 24,
+          isShow: !(['RECYCLE'].includes(this.orderType) && ['完工反馈'].includes(this.formData.type)),
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '上传图片(最多6个)',
+            prop: 'imgSrc',
+            rules: []
+          },
+          render: (h, { props, onInput }) => {
+            return <ImageUpload fileList={this.formData.imgSrc} limit={6} fileType={['image']} />
+          }
+        },
+        {
+          md: 24,
+          isShow: ['RECYCLE'].includes(this.orderType) && ['完工反馈'].includes(this.formData.type),
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '确认货品信息',
+            prop: 'orderCollectItemDTOS',
+            rules: []
+          },
+          render: (h, { props, onInput }) => {
+            return (
+              <el-tabs value="orderCollectItem_0">
+                {this.huishouwangongList.map((item, indexMain) => {
+                  return (
+                    <el-tab-pane label={`产品信息${indexMain + 1}`} name={`orderCollectItem_${indexMain}`}>
+                      <div>
+                        <zj-table
+                          isDrop={true}
+                          columns={[
+                            {
+                              columnAttributes: {
+                                label: '产品大类',
+                                prop: 'bigName'
+                              }
+                            },
+                            {
+                              columnAttributes: {
+                                label: '产品大类',
+                                prop: 'mainName'
+                              }
+                            },
+                            {
+                              columnAttributes: {
+                                label: '产品规格',
+                                prop: 'productName'
+                              }
+                            },
+                            {
+                              columnAttributes: {
+                                label: '数量',
+                                prop: 'num'
+                              }
+                            },
+                            {
+                              columnAttributes: {
+                                label: '属性',
+                                prop: 'serviceCategoryItemIds'
+                              },
+                              render: (h, { row, column, index }) => {
+                                return (
+                                  <div style="padding-left:10px">
+                                    {this.serviceCategoryListMinusData
+                                      .filter(item => row.pgOrderProductRecycles?.includes(item.serviceCategoryItemId))
+                                      .map(item => {
+                                        return `${item.categoryName}-${item.dictName}`
+                                      })
+                                      .join(',')}
+                                  </div>
+                                )
+                              }
+                            },
+                            {
+                              columnAttributes: {
+                                label: '预估金额(元)',
+                                prop: 'estimatePrice'
+                              }
+                            },
+                            {
+                              columnAttributes: {
+                                label: '导购分佣',
+                                prop: 'serviceAmount'
+                              }
+                            }
+                          ]}
+                          tableData={[item]}
+                        ></zj-table>
+                        <div style="display: flex;justify-content: flex-start;">
+                          <div style="margin-top:8px;margin-right:100px">
+                            <div>
+                              <span style="color:red">*</span>鉴定结果
+                            </div>
+                            <div>
+                              <el-radio
+                                value={item.isRecyc}
+                                onInput={v => {
+                                  item.isRecyc = v
+                                }}
+                                label={true}
+                              >
+                                回收
+                              </el-radio>
+                              <el-radio
+                                value={item.isRecyc}
+                                onInput={v => {
+                                  item.isRecyc = v
+                                }}
+                                label={false}
+                              >
+                                不回收
+                              </el-radio>
+                            </div>
+                          </div>
+                          {item.isRecyc ? (
+                            <div style="margin-top:8px;margin-right:8px">
+                              <div>
+                                <span style="color:red">*</span>应付货款(元)
+                              </div>
+                              <div>
+                                {/* max={item.estimatePrice} */}
+                                <el-input
+                                  value={item.recycPayAmount}
+                                  onInput={v => {
+                                    item.recycPayAmount = v
+                                    this.jisuanzhi()
+                                  }}
+                                  placeholder="请输入"
+                                  type="number"
+                                ></el-input>
+                              </div>
+                            </div>
+                          ) : null}
+                        </div>
+                        {item.isRecyc ? (
+                          <div style="display: flex;justify-content: flex-start;">
+                            <div style="margin-top:8px;margin-right:8px">
+                              <div>
+                                <span style="color:red">*</span>整机图片
+                              </div>
+                              <ImageUpload
+                                uid={`completeMachineImg_1235667_${indexMain}`}
+                                fileList={item.completeMachineImg}
+                                limit={1}
+                                fileType={['image']}
+                              />
+                            </div>
+                          </div>
+                        ) : null}
+                        {item.isRecyc ? (
+                          <div style="margin-top:8px">
+                            <div>其他图片</div>
+                            <ImageUpload
+                              uid={`otherImgs_1235667_${indexMain}`}
+                              fileList={item.otherImgs}
+                              limit={5}
+                              fileType={['image']}
+                            />
+                          </div>
+                        ) : null}
+                      </div>
+                    </el-tab-pane>
+                  )
+                })}
+              </el-tabs>
+            )
+          }
+        },
+        {
+          md: 24,
+          isShow: ['RECYCLE'].includes(this.orderType) && ['完工反馈'].includes(this.formData.type),
+          name: 'el-input',
+          attributes: { disabled: true, placeholder: '请输入', style: { width: '165px' } },
+          formItemAttributes: {
+            label: '合计应付货款',
+            prop: 'recycAmount',
+            rules: [...required]
+          }
         },
-        render: (h, { props, onInput }) => {
-          return (
-            <ImageUpload fileList={this.formData.imgSrc} limit={6} fileType={["image"]}/>
-          )
+        {
+          md: 24,
+          isShow: ['RECYCLE'].includes(this.orderType) && ['完工反馈'].includes(this.formData.type),
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '上传付款凭证',
+            prop: 'payCertImg',
+            rules: [...required]
+          },
+          render: (h, { props, onInput }) => {
+            return (
+              <ImageUpload
+                uid={'payCertImg_1235667'}
+                fileList={this.formData.payCertImg}
+                limit={1}
+                fileType={['image']}
+              />
+            )
+          }
         }
-      }]
+      ]
     }
   },
+  created() {
+    serviceCategoryListMinus({
+      pageNum: 1,
+      pageSize: -1,
+      params: [
+        { param: 'type_attribute', compare: '=', value: 'DED' },
+        { param: 'status', compare: '=', value: 'ON' }
+      ]
+    }).then(res => {
+      this.serviceCategoryListMinusData = res.data.records
+    })
+  },
   methods: {
+    jisuanzhi() {
+      var recycPayAmount = 0
+      this.huishouwangongList.forEach((item, index) => {
+        recycPayAmount += Number(item.recycPayAmount)
+      })
+      this.formData.recycAmount = recycPayAmount.toFixed(2)
+    },
     open() {
       this.formDialog = true
+      this.huishouwangongList = (this.orderInfo?.orderProducts || []).map(item => {
+        return {
+          ...item,
+          isRecyc: true,
+          recycPayAmount: '',
+          completeMachineImg: [],
+          otherImgs: []
+        }
+      })
     },
     formCancel() {
       this.formDialog = false
       this.formData = {
-        "orderBaseId": this.orderInfo.id,
-        "imgSrc": [],
-        "content": "",
-        "appointmentTime": "",
-        "type": this.resultCode,
-        "typeText": this.resultCode
+        orderBaseId: this.orderInfo.id,
+        imgSrc: [],
+        content: '',
+        appointmentTime: '',
+        type: this.resultCode,
+        typeText: this.resultCode,
+        recycAmount: '',
+        payCertImg: []
       }
     },
     formConfirm() {
       this.$refs.formRef.validate(valid => {
         if (valid) {
           this.lockBtn()
-          orderBaseLogAdd({
-            ...this.formData,
-            imgSrc: this.formData.imgSrc.map(item => item.url).join(",")
-          }).then(res => {
-            this.unlockBtn()
-            // 编辑保存后不跳转列表,刷新数据
-            this.acquireVerify(this, 'getorderDetail')()
-            // 刷新操作记录
-            this.acquireVerify(this, 'getOrderBaseLogList')()
-            this.$message({
-              type: 'success',
-              message: '反馈成功'
+          if (['RECYCLE'].includes(this.orderType) && ['完工反馈'].includes(this.formData.type)) {
+            try {
+              this.huishouwangongList.forEach((item, index) => {
+                if (item.isRecyc) {
+                  if (!item.completeMachineImg || !item.completeMachineImg.length) {
+                    this.$message({
+                      type: 'warning',
+                      message: `产品信息${index + 1}整机图片必须上传!`
+                    })
+                    new thrown('error')
+                  }
+                  if (!item.recycPayAmount) {
+                    this.$message({
+                      type: 'warning',
+                      message: `产品信息${index + 1}应付货款必须填写!`
+                    })
+                    new thrown('error')
+                  }
+                }
+              })
+              if (!this.formData?.payCertImg?.[0]?.url) {
+                this.$message({
+                  type: 'warning',
+                  message: `回收付款凭证必须上传!`
+                })
+                new thrown('error')
+              }
+            } catch (error) {
+              return
+            }
+            orderBaseLogAdd({
+              ...this.formData,
+              imgSrc: '',
+              pgOrderProductDetailList: this.huishouwangongList.map(item => {
+                var { completeMachineImg, otherImgs, ...data } = item
+                return { ...data }
+              }),
+              pgOrderProductDetails: [
+                ...this.huishouwangongList
+                  .map(item => {
+                    return [
+                      ...(item.completeMachineImg || []).map(item2 => {
+                        return {
+                          type: 'RECYC_MASTER',
+                          fileUrl: item2.url,
+                          orderBaseId: this.orderInfo.id,
+                          productDetailId: item.id
+                        }
+                      }),
+                      ...(item.otherImgs || []).map(item2 => {
+                        return {
+                          type: 'RECYC_OTHER',
+                          fileUrl: item2.url,
+                          orderBaseId: this.orderInfo.id,
+                          productDetailId: item.id
+                        }
+                      })
+                    ]
+                  })
+                  .reduce(function (a, b) {
+                    return a.concat(b)
+                  }),
+                {
+                  type: 'RECYC_PAY',
+                  fileUrl: this.formData?.payCertImg?.[0]?.url,
+                  orderBaseId: this.orderInfo.id
+                }
+              ]
+            })
+              .then(res => {
+                this.unlockBtn()
+                // 编辑保存后不跳转列表,刷新数据
+                this.acquireVerify(this, 'getorderDetail')()
+                // 刷新操作记录
+                this.acquireVerify(this, 'getOrderBaseLogList')()
+                this.$message({
+                  type: 'success',
+                  message: '反馈成功'
+                })
+                this.formCancel()
+              })
+              .catch(() => {
+                this.unlockBtn()
+              })
+          } else {
+            orderBaseLogAdd({
+              ...this.formData,
+              imgSrc: this.formData.imgSrc.map(item => item.url).join(',')
             })
-            this.formCancel()
-          }).catch(() => {
-            this.unlockBtn()
-          })
+              .then(res => {
+                this.unlockBtn()
+                // 编辑保存后不跳转列表,刷新数据
+                this.acquireVerify(this, 'getorderDetail')()
+                // 刷新操作记录
+                this.acquireVerify(this, 'getOrderBaseLogList')()
+                this.$message({
+                  type: 'success',
+                  message: '反馈成功'
+                })
+                this.formCancel()
+              })
+              .catch(() => {
+                this.unlockBtn()
+              })
+          }
         }
       })
     }

+ 0 - 1
src/views/workOrder/workOrderPool/detailModule/workOrderInfo/mixins/hs_productColumns.js

@@ -410,7 +410,6 @@ export default {
       ]
     }).then(res => {
       this.serviceCategoryListMinusData = res.data.records
-      console.log(this.serviceCategoryListMinusData)
     })
   },
   methods: {