gcz пре 4 година
родитељ
комит
9a7012fbce

+ 82 - 18
src/views/ums/company/components/companyDetail.vue

@@ -14,26 +14,28 @@
       <el-form-item label="供应商资质">
         <el-input v-model="company.compQual"></el-input>
       </el-form-item>
+      <!-- <el-form-item label="企业logo图片">
+         <single-upload v-model="company.compLogo"></single-upload>
+      </el-form-item> -->
       <el-form-item label="供应商图片">
-        <single-upload v-model="company.compImgs"></single-upload>
-      </el-form-item>
-      <el-form-item label="供应商资质图片">
-        <single-upload v-model="company.compQual"></single-upload>
-      </el-form-item>
-      <el-form-item label="企业logo图片">
-         <single-upload v-model="company.compQual"></single-upload>
-      </el-form-item>
-      <el-form-item label="公众号二维码图片">
-        <single-upload v-model="company.compQual"></single-upload>
+        <div>请按企业logo,供应商图片,供应商资质图片,公众号二维码图片顺序上传</div>
+        <multi-upload v-model="thecompImgs"></multi-upload>
       </el-form-item>
+      <!-- <el-form-item label="供应商资质图片">
+        <single-upload v-model="company.compQualImgs"></single-upload>
+      </el-form-item> -->
+      
+      <!-- <el-form-item label="公众号二维码图片">
+        <single-upload v-model="company.compQr"></single-upload>
+      </el-form-item> -->
       <el-form-item label="淘宝店地址">
-        <el-input v-model="company.compLevel"></el-input>
+        <el-input v-model="taobaourl"></el-input>
       </el-form-item>
       <el-form-item label="京东店地址">
-        <el-input v-model="company.compLevel"></el-input>
+        <el-input v-model="jdurl"></el-input>
       </el-form-item>
       <el-form-item label="自主商城地址">
-        <el-input v-model="company.compLevel"></el-input>
+        <el-input v-model="selfurl"></el-input>
       </el-form-item>
       <el-form-item label="是否认证">
         <el-switch          
@@ -103,12 +105,12 @@
               <bm-view :style="{width:'100%',height: '500px'}"></bm-view>
           </baidu-map>
       </el-form-item>
-      <el-form-item label="带动农户人数">
-        <!-- <el-input v-model="company.countyId"></el-input> -->
+      <!-- <el-form-item label="带动农户人数">
+        <el-input v-model="company.countyId"></el-input>
       </el-form-item>
       <el-form-item label="其中建档立卡人数">
-        <!-- <el-input v-model="company.countyId"></el-input> -->
-      </el-form-item>
+        <el-input v-model="company.countyId"></el-input>
+      </el-form-item> -->
 
       <el-form-item>
         <el-button type="primary" @click="onSubmit('companyFrom')">提交</el-button>
@@ -120,6 +122,7 @@
 <script>
   import {createCompany, getCompany, updateCompany} from '@/api/company'
   import SingleUpload from '@/components/Upload/singleUpload'
+  import MultiUpload from '@/components/Upload/multiUpload'
   import {BaiduMap,BmNavigation,BmView,BmGeolocation,BmCityList} from 'vue-baidu-map'
   const defaultCompany={
     cityId: "",
@@ -160,6 +163,7 @@
     name: 'companyDetail',
     components:{
       SingleUpload,
+      MultiUpload,
       BaiduMap,
       BmNavigation,
       BmView,
@@ -176,6 +180,9 @@
     data() {
       return {
         company:Object.assign({}, defaultCompany),
+        jdurl:'',
+        taobaourl:'',
+        selfurl:'',
         rules: {
           compName: [
             {required: true, message: '请输入品牌名称', trigger: 'blur'},
@@ -198,13 +205,70 @@
       if (this.isEdit) {
         getCompany(this.$route.query.id).then(response => {
           this.company = response.data;
+          // 商城地址
+          let jdshop =  this.company.shops.filter( (item) => {
+            return item.shopType == "jd"
+          });
+          if(jdshop.length>0){this.jdurl = jdshop[0].shopUrl;}   
+
+          let taobaoshop =  this.company.shops.filter( (item) => {
+            return item.shopType == "taobao"
+          });
+          if(taobaoshop.length>0){this.taobaourl = taobaoshop[0].shopUrl;}
+          // 商城地址
+          console.log('this.company',JSON.parse(JSON.stringify(this.company)));
         });
       }else{
         this.company = Object.assign({},defaultCompany);
       }
     },
+    computed: {
+      //供应商图片
+      thecompImgs:{
+        get:function () {
+          let pics=[];
+          if(this.company.files===undefined||this.company.files==null||this.company.files===''){
+            return pics;
+          }
+          let compImgs = this.company.files;
+          for(let i=0;i<compImgs.length;i++){
+            pics.push(compImgs[i].fileUrl);
+          }
+          return pics;
+        },
+        set:function (newValue) {     
+          // console.log('newValue',newValue);
+          if (newValue == null || newValue.length === 0) {
+            this.company.files = null;
+          } else {
+            this.company.files = [];
+            if (newValue.length >= 1) {              
+              for (let i = 0; i < newValue.length; i++) {
+                 this.company.files.push({fileUrl:newValue[i],fileType:"company"});
+                // this.company.files += newValue[i];
+                // if (i !== newValue.length - 1) {
+                //   this.company.files += ',';
+                // }
+              }
+            }
+          }
+        }
+      }
+    },
     methods: {
       onSubmit(formName) {
+        console.log('this.taobaourl',this.taobaourl);
+        // 商城地址
+        this.company.shops=[];
+        if(this.taobaourl.length>0){
+          this.company.shops.push({shopType:'taobao',shopUrl:this.taobaourl});
+        }
+
+        if(this.jdurl.length>0){
+          this.company.shops.push({shopType:'jd',shopUrl:this.jdurl});
+        }
+
+        // 商城地址
         console.log('this.company',JSON.parse(JSON.stringify(this.company)))
         // return false;
         this.$refs[formName].validate((valid) => {
@@ -260,7 +324,7 @@
           let _this = this;	// 设置一个临时变量指向vue实例;
           var geolocation = new BMap.Geolocation();
           geolocation.getCurrentPosition(function(r){
-            console.log(r);
+            // console.log(r);
             _this.center = {lng: r.longitude, lat: r.latitude};		// 设置center属性值
             _this.autoLocationPoint = {lng: r.longitude, lat: r.latitude};		// 自定义覆盖物
             _this.initLocation = true;

+ 8 - 5
src/views/ums/company/index.vue

@@ -81,7 +81,10 @@
           <template slot-scope="scope">{{scope.row.companyType}}</template>
         </el-table-column>
         <el-table-column label="是否认证" align="center">
-          <template slot-scope="scope">{{scope.row.isCert}}</template>
+          <template slot-scope="scope">
+            <div v-if="scope.row.isCert == 1">是</div>
+            <div v-else>否</div>
+          </template>          
         </el-table-column>
         <el-table-column label="生产许可证号" align="center">
           <template slot-scope="scope">{{scope.row.compProdLicenseNum}}</template>
@@ -125,12 +128,12 @@
         <el-table-column label="维度(°)" align="center">
           <template slot-scope="scope">{{scope.row.latitude}}</template>
         </el-table-column>
-        <el-table-column label="带动农户人数" align="center">
-          <!-- <template slot-scope="scope">{{scope.row.countyId}}</template> -->
+        <!-- <el-table-column label="带动农户人数" align="center">
+          <template slot-scope="scope">{{scope.row.countyId}}</template>
         </el-table-column>
         <el-table-column label="其中建档立卡人数" align="center">
-          <!-- <template slot-scope="scope">{{scope.row.countyId}}</template> -->
-        </el-table-column>
+          <template slot-scope="scope">{{scope.row.countyId}}</template>
+        </el-table-column> -->
         <el-table-column label="操作" width="160" fixed="right" align="center">
           <template slot-scope="scope">
             <el-row>

+ 4 - 3
src/views/ums/origin/components/originDetail.vue

@@ -198,9 +198,9 @@
             this.origin.imgUrl = null;
           } else {
             // this.origin.pic = newValue[0];
-            this.origin.imgUrl = '1';
-            if (newValue.length > 1) {
-              for (let i = 1; i < newValue.length; i++) {
+            this.origin.imgUrl = '';
+            if (newValue.length >= 1) {
+              for (let i = 0; i < newValue.length; i++) {
                 this.origin.imgUrl += newValue[i];
                 if (i !== newValue.length - 1) {
                   this.origin.imgUrl += ',';                  
@@ -218,6 +218,7 @@
       if (this.isEdit) {
         getOrigin(this.$route.query.id).then(response => {
           this.origin = response.data;
+          console.log('this.origin',JSON.parse(JSON.stringify(this.origin)));
         });
       }else{
         this.origin = Object.assign({},defaultorigin);