linwenxin пре 1 година
родитељ
комит
5ac44b7900
1 измењених фајлова са 63 додато и 38 уклоњено
  1. 63 38
      src/views/secondHandMall/commodityManagement/form.vue

+ 63 - 38
src/views/secondHandMall/commodityManagement/form.vue

@@ -17,7 +17,7 @@
       <el-button v-if="formData.id && ~['ON'].indexOf(formData.status)" type="primary" size="small"
         @click="setStatus('OFF')">下架</el-button>
       <el-button v-if="formData.id && ~['ON', 'OFF'].indexOf(formData.status)" type="primary" size="small"
-        @click="zhuanxiaoshou">转销售</el-button>
+        @click="setStatus('SALE')">转销售</el-button>
       <el-button v-if="formData.id && ~['OFF'].indexOf(formData.status)" type="primary" size="small"
         @click="setStatus('ON')">重新上架</el-button>
       <el-button size="small" @click="handleClose">取消</el-button>
@@ -27,7 +27,8 @@
 
 <script>
 import ImageUpload from '@/components/Common/image-upload.vue'
-import { esGoodsDetail, esGoodsCopy, esGoodsBatchUpdateStatus, esGoodsReply } from '@/api/commodityManagement'
+import { esGoodsDetail, esGoodsCopy, esGoodsBatchUpdateStatus, esGoodsReply, esGoodsUpdate } from '@/api/commodityManagement'
+import { getClassifyList } from '@/api/goods'
 export default {
   components: { ImageUpload },
   props: {
@@ -38,6 +39,7 @@ export default {
   },
   data() {
     return {
+      classifyList: [],
       formData: {
         "brand": "",
         "categoryId": "",
@@ -75,15 +77,21 @@ export default {
   },
   computed: {
     disabled(){
-      return this.detailId? !~['ON', 'OFF'].indexOf(this.formData?.status) : false
+      return ~['ON', 'OFF'].indexOf(this.formData?.status) ? false : true
     },
     formItems() {
       return [
         {
-          name: 'el-input',
+          name: 'el-select',
           md: 12,
+          options: this.classifyList.map(item=>({label: item.name,value: item.categoryId})),
           attributes: { disabled: this.disabled },
-          formItemAttributes: { label: '商品分类', prop: 'categoryName' }
+          formItemAttributes: { label: '商品分类', prop: 'categoryId' },
+          events: {
+            change: (val) => {
+              this.formData.categoryName = this.classifyList.find(item=>item.categoryId == val)?.name
+            }
+          }
         },
         {
           name: 'el-radio',
@@ -176,18 +184,22 @@ export default {
           formItemAttributes: { label: '能效标识', prop: 'mark' }
         },
         {
-          name: 'slot-component',
           md: 24,
-          attributes: { disabled: this.disabled },
-          formItemAttributes: { label: '商品图片', prop: 'imgList' },
-          render: (h, { props }) => {
-            return (<div>
-              <ImageUpload file-list={this.formData.imgList} limit={this.formData?.imgList?.length + 1} isEdit={false} />
-            </div>)
+          name: 'slot-component',
+          formItemAttributes: {
+            label: '商品图片',
+            prop: 'imgList',
+            rules: []
+          },
+          render: (h, { props, onInput }) => {
+            return (
+              <ImageUpload fileList={this.formData.imgList} limit={100} isEdit={!this.disabled}/>
+            )
           }
-        },
+        }
       ]
     },
+    // esOrderInfo
     formItems2() {
       return [{
         name: 'slot-component',
@@ -195,25 +207,23 @@ export default {
         attributes: { disabled: this.disabled },
         formItemAttributes: { label: '', prop: '', 'label-width': '0px' },
         render: (h, { props }) => {
-          var { formData } = props
-          console.log(formData, 999)
           return (<div>
             <el-row gutter={10}>
               <el-col xs={24} sm={24} md={8} lg={8} xl={8}>
                 <div class='info'>
-                  <div class='info_title'>上架人信息</div>
+                  <div class='info_title'>卖家信息</div>
                   <div class='info_bottom'>
                     <div class='info_bottom_lt'>
                       <el-image
                         style='width: 40px; height: 40px'
-                        src={this.$imageUrl + this.formData?.order?.buyerUserPic}
+                        src={this?.formData?.esOrderInfo?.sellUrl}
                       >
                       </el-image>
                     </div>
                     <div class='info_bottom_rt'>
-                      <div>微信昵称:{formData.userName}</div>
-                      <div>微信手机号:{formData.phone}</div>
-                      <div>发布时间:{formData.goodsCreateTime}</div>
+                      <div>微信昵称:{this?.formData?.esOrderInfo?.sellName}</div>
+                      <div>微信手机号:{this?.formData?.esOrderInfo?.sellMobile}</div>
+                      <div>发布时间:{this?.formData?.esOrderInfo?.sellTime}</div>
                     </div>
                   </div>
                 </div>
@@ -225,16 +235,16 @@ export default {
                       <div class='info_bottom_lt'>
                         <el-image
                           style='width: 40px; height: 40px'
-                          src={this.$imageUrl + this?.formData?.userPic}
+                          src={this?.formData?.esOrderInfo?.wechatUserUrl}
                         >
                         </el-image>
                       </div>
                       <div class='info_bottom_rt'>
-                        <div>微信昵称:{formData.buyerUserName}</div>
-                        <div>微信手机号:{formData.buyerUserPhone}</div>
-                        <div>收货人信息:{formData.consigneeName}</div>
-                        <div>收货人地址:{formData.address}</div>
-                        <div>支付方式:{formData.payType === 'WECHAT' ? '微信支付' : ''}</div>
+                        <div>微信昵称:{this?.formData?.esOrderInfo?.wechatUserName}</div>
+                        <div>微信手机号:{this?.formData?.esOrderInfo?.wechatUserMobile}</div>
+                        <div>收货人信息:{`(${this?.formData?.esOrderInfo?.userMobile||''}) ${this?.formData?.esOrderInfo?.userMobile||''}`}</div>
+                        <div>收货人地址:{this?.formData?.esOrderInfo?.sellName}</div>
+                        <div>支付方式:{({WECHAT:"微信支付", CASH:"现金支付", TRANSFER:"转账支付"})[this?.formData?.esOrderInfo?.payType]}</div>
                       </div>
                     </div>
                 </div>
@@ -245,15 +255,16 @@ export default {
                   <div class='info_bottom'>
                     <div class='info_bottom_rt'>
                       <div>
-                        <el-radio-group value={formData.logisticsType}>
+                        <el-radio-group disabled={true} value={this?.formData?.esOrderInfo?.logisticsType}>
                           <el-radio label='SELF'>自提</el-radio>
                           <el-radio label='DELIVERY'>物流</el-radio>
                         </el-radio-group>
                       </div>
-                      <div>快递单号:{formData.logisticsNum}</div>
-                      <div>快递公司:{formData.logisticsName}</div>
-                      <el-button type='primary' size='small' onClick={() => { }}
-                      >查看物流
+                      <div>快递单号:{this?.formData?.esOrderInfo?.logisticsNo}</div>
+                      <div>快递公司:{this?.formData?.esOrderInfo?.logisticsName}</div>
+                      <el-button type='primary' size='small' onClick={() => { 
+                      
+                      }}>查看物流
                       </el-button>
                     </div>
                   </div>
@@ -336,13 +347,12 @@ export default {
           return
         }
         esGoodsDetail({ id: newVal }).then(res => {
-          console.log(res.data)
           this.formData = {
             ...res.data,
             imgList: res.data.imgList.map(item => {
               return {
                 ...item,
-                imgUrl: item.imgUrl
+                url: item.imgUrl
               }
             })
           }
@@ -352,6 +362,14 @@ export default {
       immediate: true,
     }
   },
+  created(){
+    getClassifyList({
+      status:true,
+      type:5
+    }).then(res=>{
+      this.classifyList = res.data
+    })
+  },
   methods: {
     msgSend(row){
       this.$prompt('留言回复', '回复', {
@@ -372,7 +390,7 @@ export default {
                 imgList: res2.data.imgList.map(item => {
                   return {
                     ...item,
-                    imgUrl: item.imgUrl
+                    url: item.imgUrl
                   }
                 })
               }
@@ -393,11 +411,18 @@ export default {
         this.handleClose()
       })
     },
-    zhuanxiaoshou(){
-      
-    },
     handleSubmit() {
-
+      this.$refs.formRef.validate((valid) => {
+        if (valid) {
+          esGoodsUpdate({
+            ...this.formData,
+            imgList: this.formData.imgList.map(item=>({...item, imgUrl:item.url}))
+          }).then(res=>{
+            this.$message({ type: 'success', message: `成功!` })
+            this.$emit('back')
+          })
+        }
+      });
     },
     handleClose() {
       this.$emit('back')