Browse Source

no message

linwenxin 1 year ago
parent
commit
d0a91a9869
2 changed files with 129 additions and 24 deletions
  1. 8 0
      src/api/commodityManagement.js
  2. 121 24
      src/views/secondHandMall/commodityManagement/form.vue

+ 8 - 0
src/api/commodityManagement.js

@@ -63,3 +63,11 @@ export function esGoodsTop(params) {
     params
     params
   })
   })
 }
 }
+
+export function esGoodsReply(params) {
+  return request({
+    url: '/es/goods/reply',
+    method: 'post',
+    params
+  })
+}

+ 121 - 24
src/views/secondHandMall/commodityManagement/form.vue

@@ -2,21 +2,23 @@
   <zj-page-container>
   <zj-page-container>
     <zj-page-fill class="neibuview">
     <zj-page-fill class="neibuview">
       <zj-form-container ref="formRef" :form-data="formData" :form-rules="formRules">
       <zj-form-container ref="formRef" :form-data="formData" :form-rules="formRules">
-        <zj-form-module title="商品详情" :form-data="formData" :form-items="formItems" label-width="80px" :column="3">
+        <zj-form-module title="商品详情" :form-data="formData" :form-items="formItems" label-width="80px">
         </zj-form-module>
         </zj-form-module>
         <zj-form-module title="出售信息" class="my-module" :form-data="formData.order" :form-items="formItems2"
         <zj-form-module title="出售信息" class="my-module" :form-data="formData.order" :form-items="formItems2"
-          label-width="80px" :column="3" />
+          label-width="0px"/>
+          <zj-form-module title="查看留言" class="my-module" :form-data="formData.order" :form-items="formItems3"
+          label-width="0px"/>
       </zj-form-container>
       </zj-form-container>
     </zj-page-fill>
     </zj-page-fill>
     <div style="box-sizing: border-box; padding: 10px; text-align: right;">
     <div style="box-sizing: border-box; padding: 10px; text-align: right;">
       <el-button type="primary" size="small" @click="handleSubmit">保存</el-button>
       <el-button type="primary" size="small" @click="handleSubmit">保存</el-button>
-      <el-button v-if="formData.id && ~['OFF'].indexOf(formData.status)" type="primary" size="small"
+      <el-button v-if="formData.id && ~['SALE'].indexOf(formData.status)" type="primary" size="small"
         @click="copyGoods">克隆商品</el-button>
         @click="copyGoods">克隆商品</el-button>
       <el-button v-if="formData.id && ~['ON'].indexOf(formData.status)" type="primary" size="small"
       <el-button v-if="formData.id && ~['ON'].indexOf(formData.status)" type="primary" size="small"
         @click="setStatus('OFF')">下架</el-button>
         @click="setStatus('OFF')">下架</el-button>
-      <el-button v-if="formData.id && ~['ON', 'SALE'].indexOf(formData.status)" type="primary" size="small"
+      <el-button v-if="formData.id && ~['ON', 'OFF'].indexOf(formData.status)" type="primary" size="small"
         @click="handleSubmit">转销售</el-button>
         @click="handleSubmit">转销售</el-button>
-      <el-button v-if="formData.id && ~['SALE'].indexOf(formData.status)" type="primary" size="small"
+      <el-button v-if="formData.id && ~['OFF'].indexOf(formData.status)" type="primary" size="small"
         @click="setStatus('ON')">重新上架</el-button>
         @click="setStatus('ON')">重新上架</el-button>
       <el-button size="small" @click="handleClose">取消</el-button>
       <el-button size="small" @click="handleClose">取消</el-button>
     </div>
     </div>
@@ -25,7 +27,7 @@
 
 
 <script>
 <script>
 import ImageUpload from '@/components/Common/image-upload.vue'
 import ImageUpload from '@/components/Common/image-upload.vue'
-import { esGoodsDetail, esGoodsCopy, esGoodsBatchUpdateStatus } from '@/api/commodityManagement'
+import { esGoodsDetail, esGoodsCopy, esGoodsBatchUpdateStatus, esGoodsReply } from '@/api/commodityManagement'
 export default {
 export default {
   components: { ImageUpload },
   components: { ImageUpload },
   props: {
   props: {
@@ -65,74 +67,77 @@ export default {
       },
       },
       formRules: {},
       formRules: {},
       publishStatus: [
       publishStatus: [
-        { label: '下架', value: "SALE" },
+        { label: '下架', value: "OFF" },
         { label: '上架', value: "ON" },
         { label: '上架', value: "ON" },
-        { label: '已卖出', value: "OFF" },
+        { label: '已卖出', value: "SALE" },
       ],
       ],
     }
     }
   },
   },
   computed: {
   computed: {
+    disabled(){
+      return this.detailId? !~['ON', 'OFF'].indexOf(this.formData?.status) : false
+    },
     formItems() {
     formItems() {
       return [
       return [
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 12,
           md: 12,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '商品分类', prop: 'categoryName' }
           formItemAttributes: { label: '商品分类', prop: 'categoryName' }
         },
         },
         {
         {
           name: 'el-radio',
           name: 'el-radio',
           options: this.publishStatus,
           options: this.publishStatus,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           md: 12,
           md: 12,
           formItemAttributes: { label: '发布状态', prop: 'status' }
           formItemAttributes: { label: '发布状态', prop: 'status' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 12,
           md: 12,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '商品名称', prop: 'goodsName' }
           formItemAttributes: { label: '商品名称', prop: 'goodsName' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 12,
           md: 12,
-          attributes: { disabled: true, type: 'textarea' },
+          attributes: { disabled: this.disabled, type: 'textarea' },
           formItemAttributes: { label: '商品描述', prop: 'goodsNote' }
           formItemAttributes: { label: '商品描述', prop: 'goodsNote' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 6,
           md: 6,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '商品价格', prop: 'price' }
           formItemAttributes: { label: '商品价格', prop: 'price' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 6,
           md: 6,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '上架数量', prop: 'qty' }
           formItemAttributes: { label: '上架数量', prop: 'qty' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 6,
           md: 6,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '商品品牌', prop: 'brand' }
           formItemAttributes: { label: '商品品牌', prop: 'brand' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 6,
           md: 6,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '功率(W)', prop: 'power' }
           formItemAttributes: { label: '功率(W)', prop: 'power' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 6,
           md: 6,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '制造日期', prop: 'makeDate' }
           formItemAttributes: { label: '制造日期', prop: 'makeDate' }
         },
         },
         {
         {
           name: 'el-input',
           name: 'el-input',
           md: 6,
           md: 6,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '联系电话', prop: 'linkPhone' }
           formItemAttributes: { label: '联系电话', prop: 'linkPhone' }
         },
         },
         {
         {
@@ -143,7 +148,7 @@ export default {
         },
         },
         {
         {
           name: 'slot-component',
           name: 'slot-component',
-          md: 24,
+          md: 6,
           attributes: { disabled: true, placeholder: '' },
           attributes: { disabled: true, placeholder: '' },
           formItemAttributes: { label: '留言量', prop: '' },
           formItemAttributes: { label: '留言量', prop: '' },
           render: (h, { props }) => {
           render: (h, { props }) => {
@@ -167,13 +172,13 @@ export default {
             { label: '五级能效', value: "五级能效" },
             { label: '五级能效', value: "五级能效" },
           ],
           ],
           md: 24,
           md: 24,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '能效标识', prop: 'mark' }
           formItemAttributes: { label: '能效标识', prop: 'mark' }
         },
         },
         {
         {
           name: 'slot-component',
           name: 'slot-component',
           md: 24,
           md: 24,
-          attributes: { disabled: true },
+          attributes: { disabled: this.disabled },
           formItemAttributes: { label: '商品图片', prop: 'imgList' },
           formItemAttributes: { label: '商品图片', prop: 'imgList' },
           render: (h, { props }) => {
           render: (h, { props }) => {
             return (<div>
             return (<div>
@@ -187,8 +192,8 @@ export default {
       return [{
       return [{
         name: 'slot-component',
         name: 'slot-component',
         md: 24,
         md: 24,
-        attributes: { disabled: true },
-        formItemAttributes: { label: '', prop: '' },
+        attributes: { disabled: this.disabled },
+        formItemAttributes: { label: '', prop: '', 'label-width': '0px' },
         render: (h, { props }) => {
         render: (h, { props }) => {
           var { formData } = props
           var { formData } = props
           console.log(formData, 999)
           console.log(formData, 999)
@@ -258,7 +263,99 @@ export default {
           </div>)
           </div>)
         }
         }
       }]
       }]
-    }
+    },
+    formItems3() {
+      return [{
+        name: 'slot-component',
+        md: 24,
+        attributes: { disabled: this.disabled },
+        formItemAttributes: { label: '', prop: 'messageList', 'label-width': '0px' },
+        render: (h, { props }) => {
+          var { formData } = props
+          return <div>
+            <zj-table
+              columns={[
+                {
+                  columnAttributes: {
+                    label: '留言人名称',
+                    prop: 'createBy'
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '留言内容',
+                    prop: 'content'
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '留言时间',
+                    prop: 'createTime'
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '回复人名称',
+                    prop: 'replyBy'
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '回复内容',
+                    prop: 'replyContent'
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '回复时间',
+                    prop: 'replyTime'
+                  }
+                },
+                {
+                  columnAttributes: {
+                    label: '操作',
+                  },
+                  render: (h, { row, column, index }) => {
+                    return <div style="padding-left:10px">
+                      <el-button type="text" onClick={() => {
+                        this.$prompt('留言回复', '回复', {
+                          confirmButtonText: '确定',
+                          cancelButtonText: '取消',
+                          inputType: "textarea"
+                        }).then(({ value }) => {
+                          if(value){
+                            esGoodsReply({
+                              id:this.detailId,
+                              messageId:row.id,
+                              content:value
+                            }).then(res => {
+                              this.$message({ type: 'success', message: `设置成功!` })
+                              esGoodsDetail({ id: this.detailId }).then(res2 => {
+                                this.formData = {
+                                  ...res2.data,
+                                  imgList: res2.data.imgList.map(item => {
+                                    return {
+                                      ...item,
+                                      imgUrl: item.imgUrl
+                                    }
+                                  })
+                                }
+                              })
+                            })
+                          }
+                        })
+                      }}>回复</el-button>
+                    </div>
+                  }
+                }
+              ]}
+              tableData={this.formData.messageList}
+            >
+            </zj-table>
+          </div>
+        }
+      }]
+    },
   },
   },
   watch: {
   watch: {
     detailId: {
     detailId: {