Selaa lähdekoodia

商品模块修复BUG

zhengjinyi 4 vuotta sitten
vanhempi
commit
5dfa236868

+ 4 - 2
src/main/resources/static/css/flea-market/form.css

@@ -28,9 +28,11 @@ body{background: #fff}
      .border-grey {width: 496px;height: 114px;background-color: #ffffff;border-radius: 2px;border: solid 1px #b8bfca;margin-top: 20px;resize: none;padding: 10px}
      #description {margin-top: 0;}
      .upload-file {position: relative;float: left;margin: 10px 10px 10px 0px;cursor: pointer;width: 80px;height: 80px;border-radius: 2px;border: solid 1px #b8bfca;}
-     .login-form input.upload-file-name{ width: 388px; }
+     .upload-file-view{width: 100%;height: 36px;position: relative;}
+     .upload-file-view .del:before{cursor: pointer;}
+     .login-form input.upload-file-name{ width: 100%;box-sizing: border-box;}
      .input-file {width: 80px;height: 80px;opacity: 0;cursor: pointer;position: absolute;}
-     .input-file-btn {width: 90px;height: 36px;cursor: pointer;position: absolute;	background-color: #ffe6dc;border-radius: 2px;border: solid 1px #e15616;text-align: center;line-height: 36px;font-size: 14px;color: #e15616;position: relative;float: right;}
+     .input-file-btn {width: 90px;height: 34px;cursor: pointer;position: absolute;	background-color: #ffe6dc;border-radius: 2px;border: solid 1px #e15616;text-align: center;line-height: 36px;font-size: 14px;color: #e15616;top: 0;right: 0;}
      .input-file-btn input{width: 90px;height: 36px;opacity: 0;cursor: pointer;position: absolute;top: 0;left: 0;z-index: 999;}
      .upload-img {width: 100%;height: 100%;display: block;border-radius: 2px;}
      .add-text {font-size: 12px;color: #333330;opacity: 0.5;position: absolute;top: 60%;right: 13px}

+ 13 - 0
src/main/resources/static/js/common/serviceapi/second.service.js

@@ -22,6 +22,19 @@ var SecondApi = {
                 data:params
             },callback)
         },
+        deleteOssFile: function (params, callback) {//删除Oss文件
+            Http.AjaxService({
+                url:'/file/delete',
+                type:'post',
+                data:params,
+                json:false,
+                mask:true,
+                replace:false
+            })
+            .then(function(res){
+                callback(res);
+            });
+        },
         SeconHandProductList: function (params, callback) {//商品列表
             Http.AjaxService({
                 url:'/commodity/second/list',

+ 17 - 6
src/main/resources/static/js/flea-market/form.js

@@ -21,7 +21,7 @@ var fleaMarketForm = new Vue({
         BrandList:[],
         isShow:false,
         includedTax:'',
-        GoodsImagesList:[''],
+        GoodsImagesList:['https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2306696130,3636777462&fm=26&gp=0.jpg'],
         oldNum:0,
         secondType:0,
         vShow_GoodsImages:false,
@@ -47,13 +47,13 @@ var fleaMarketForm = new Vue({
             secondProductType:'',//
             townId:'',//县区地址
             address:'',//详细地址
-            image:'',//图片
+            image:'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2306696130,3636777462&fm=26&gp=0.jpg',//图片
             productDetails:'',//商品详细信息
             source:1,
             dockingPeopleMobile:'',
             dockingPeopleName:'',
-            authenticationImage:'',//身份证照片
-            commitmentImage:'',//承诺函图片
+            authenticationImage:'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2306696130,3636777462&fm=26&gp=0.jpg',//身份证照片
+            commitmentImage:'https://dss2.bdstatic.com/70cFvnSh_Q1YnxGkpoWK1HF6hhy/it/u=2306696130,3636777462&fm=26&gp=0.jpg',//承诺函图片
             fileName:'',//文件名称
             ossName:'',//文件OSS名称
          },
@@ -198,14 +198,25 @@ var fleaMarketForm = new Vue({
             _this.GoodsImagesList.splice(index,1);
             _this.secondParams.image =_this.GoodsImagesList.toString()+',';
         },
-        removeAuthenticationImagesFn:function(){
+        removeAuthenticationImagesFn:function(){//删除身份验证照片
             var _this = this;
             _this.secondParams.authenticationImage = '';
         },
-        removeCommitmentImagesFn:function(){
+        removeCommitmentImagesFn:function(){//删除授权函文件图片
             var _this = this;
             _this.secondParams.commitmentImage = '';
         },
+        deleteCommitmentFile:function(){//删除承诺函文件
+            var _this = this;
+            SecondApi.deleteOssFile({ ossName : _this.secondParams.ossName },function (response) {
+                if (response.code==0){
+                    _this.secondParams.fileName = '';
+                    _this.secondParams.ossName = '';
+                }else{
+                    console.log('删除文件异常提示===>',response.msg)
+                }
+            })
+        },
         getProductType:function(item){
             var _this = this;
             _this.secondType=item;

+ 7 - 4
src/main/resources/templates/flea-market/form.html

@@ -169,10 +169,13 @@
                         </div>
                         <div class="unlogin-item input-item shrink-spacing">
                             <div class="unlogin-label spacing">二手出让承诺函文件:<span style="color:#ffb496">(仅支持pdf文件)</span>:</div>
-                            <input class="upload-file-name" type="text" v-model="secondParams.fileName" disabled="disabled">
-                            <div class="input-file-btn">
-                                上传文件
-                                <input class="input-file-btn"  ref="CommitmentImagefile" type="file" name="file" value="" accept=".pdf"  @change="uploadCommitmentFileFn">
+                            <div class="upload-file-view">
+                                <input class="upload-file-name" type="text" v-model="secondParams.fileName" disabled="disabled">
+                                <div class="input-file-btn" v-if="secondParams.ossName == ''">
+                                    上传文件
+                                    <input class="input-file-btn"  ref="CommitmentImagefile" type="file" name="file" value="" accept=".pdf"  @change="uploadCommitmentFileFn">
+                                </div>
+                                <i class="icon mIcon del" v-else @click="deleteCommitmentFile"></i>
                             </div>
                         </div>
                         <div class="release-main-container">