瀏覽代碼

收费信息添加交易图片

wangxiaoming 5 年之前
父節點
當前提交
9361dca52c

+ 9 - 0
watero-rst-core/src/main/java/com.iamberry.rst.core/cm/InformationInfo.java

@@ -13,6 +13,7 @@ public class InformationInfo implements Serializable{
     private Integer feeOriginally;//收费原由1:以旧换新   2:机器维修 3:机器运费
     private Integer feePayChannel;//支付渠道1:微信   2:支付宝 3:银行卡
     private Integer feePayAccount;//支付账号
+    private String feePayPicture;//交易图片
     private Integer feeStatus;//状态1代付款,2已收款
     private Integer feeDesc;//
     private Integer feeCreateTime;
@@ -88,4 +89,12 @@ public class InformationInfo implements Serializable{
     public void setFeeCreateTime(Integer feeCreateTime) {
         this.feeCreateTime = feeCreateTime;
     }
+
+    public String getFeePayPicture() {
+        return feePayPicture;
+    }
+
+    public void setFeePayPicture(String feePayPicture) {
+        this.feePayPicture = feePayPicture;
+    }
 }

+ 3 - 1
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/SalesOrderServiceImpl.java

@@ -454,7 +454,9 @@ public class SalesOrderServiceImpl implements SalesOrderService {
             if(listSalesOrder.size() > 0){
                 for (int i = 0;i<listSalesOrder.size();i++){
                     listSalesOrder.get(i).setSalesDealCode(listSalesOrder.get(i).getSalesDealCode()+"-"+(i+1));
-                    listSalesOrder.get(i).setSalesOrderId(listSalesOrder.get(i).getSalesOrderId()+"-"+(i+1));
+                    if(listSalesOrder.get(i).getSalesOrderId() != null && !"".equals(listSalesOrder.get(i).getSalesOrderId())){
+                        listSalesOrder.get(i).setSalesOrderId(listSalesOrder.get(i).getSalesOrderId()+"-"+(i+1));
+                    }
                     listSalesOrder.get(i).setSalesMainOrderId(mainOrder.getSalesId());
                     listSalesOrder.get(i).setSalesId(null);
                     orderNum = salesOrderMapper.addSalesOrder(listSalesOrder.get(i));

+ 5 - 0
watero-rst-service/src/main/java/com/iamberry/rst/service/cm/mapper/customerInfoMapper.xml

@@ -1510,6 +1510,7 @@ LEFT JOIN tb_rst_cm_sendback_info csi ON csi.relation_id = cr.relation_id
       fee_originally,
       fee_pay_channel,
       fee_pay_account,
+      fee_pay_picture,
       fee_status,
       fee_desc,
       fee_create_time
@@ -1521,6 +1522,7 @@ LEFT JOIN tb_rst_cm_sendback_info csi ON csi.relation_id = cr.relation_id
       #{feeOriginally},
       #{feePayChannel},
       #{feePayAccount},
+      #{feePayPicture},
       #{feeStatus},
       #{feeDesc},
       NOW()
@@ -1542,6 +1544,9 @@ LEFT JOIN tb_rst_cm_sendback_info csi ON csi.relation_id = cr.relation_id
       <if test="feePayAccount != null and feePayAccount != ''">
         fee_pay_account = #{feePayAccount},
       </if>
+      <if test="feePayPicture != null and feePayPicture != ''">
+          fee_pay_picture = #{feePayPicture},
+      </if>
       <if test="feeStatus != null and feeStatus != ''">
         fee_status = #{feeStatus},
       </if>

+ 36 - 0
watero-rst-web/src/main/java/com/iamberry/rst/controllers/cm/AdminCustomerController.java

@@ -44,6 +44,7 @@ import org.springframework.stereotype.Controller;
 import org.springframework.web.bind.annotation.RequestMapping;
 import org.springframework.web.bind.annotation.RequestParam;
 import org.springframework.web.bind.annotation.ResponseBody;
+import org.springframework.web.multipart.commons.CommonsMultipartFile;
 import org.springframework.web.servlet.ModelAndView;
 
 import javax.servlet.ServletOutputStream;
@@ -2504,6 +2505,41 @@ public class AdminCustomerController {
     }
 
     /**
+     * 上传交易图片
+     * @RequestParam("file") 将name=file控件得到的文件封装成CommonsMultipartFile 对象
+     */
+    @ResponseBody
+    @RequestMapping("/fee_fileUpload")
+    public ResponseJson fileUpload(HttpServletRequest request, @RequestParam(value = "file",required = false)  CommonsMultipartFile file) throws IOException {
+        ResponseJson responseJson = new ResponseJson();
+        if(file == null || file.getOriginalFilename() == null || "".equals(file.getOriginalFilename())){
+            responseJson.setReturnCode(500);
+            return responseJson;
+        }
+
+        System.out.println("fileName:"+file.getOriginalFilename());
+
+        String realPath = request.getSession().getServletContext().getRealPath("/");
+
+        String oldName = file.getOriginalFilename();
+
+        //名称
+        String suffix = file.getOriginalFilename().substring(file.getOriginalFilename().toString().lastIndexOf("."));
+        String name = System.currentTimeMillis()+suffix;
+
+        String path = UploadFileUtils.cmFeePayPictureUploadFile(realPath,name,file);
+
+        String url = request.getScheme()+"://"+ request.getServerName();
+
+        responseJson.setReturnCode(200);
+        responseJson.addResponseKeyValue("allImgUrl",url + "/" + path);
+        responseJson.addResponseKeyValue("imgUrl",path);
+        responseJson.addResponseKeyValue("oldName",oldName);
+        responseJson.addResponseKeyValue("name",name);
+        return responseJson;
+    }
+
+    /**
      * 修改收费
      * @param request
      * @param informationInfo

+ 16 - 0
watero-rst-web/src/main/java/com/iamberry/rst/utils/UploadFileUtils.java

@@ -20,6 +20,7 @@ public class UploadFileUtils {
     private UploadFileUtils(){
         map.put("scmOrder","scmOrder");
         map.put("eiInvo","eiInvo");
+        map.put("cm","cm");
     };
 
     /**
@@ -112,4 +113,19 @@ public class UploadFileUtils {
         return path;
     }
 
+    /**
+     * 售后管理-交易图片上传
+     * path  : common/upload/yyyyMMdd/
+     * @param name
+     * @param file
+     * @return
+     */
+    public static String cmFeePayPictureUploadFile(String rootPathh, String name, CommonsMultipartFile file){
+        SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
+        String soonPath = "/feePayPicture/"+ sdf.format(new Date()) + "/";
+        String path = UploadFileUtils.getUf().upload("cm",rootPathh,soonPath,name,file);
+        return path;
+    }
+
+
 }

+ 1 - 1
watero-rst-web/src/main/resources/watero-web-mvc.xml

@@ -83,7 +83,7 @@
         <!-- 默认的编码 -->
         <property name="defaultEncoding" value="UTF-8"/>
         <!-- 最大上传大小 -->
-        <property name="maxUploadSize" value="1024000"/>
+        <property name="maxUploadSize" value="10240000"/>
     </bean>
 
     <!--避免IE执行AJAX时,返回JSON出现下载文件 -->

+ 120 - 24
watero-rst-web/src/main/webapp/WEB-INF/views/cm/customer/update_relation.ftl

@@ -30,6 +30,7 @@
         .td-manage>a{color: #50a2ea;}
         input[type=radio]{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-1.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
         input[type=radio]:checked{-webkit-appearance:none;appearance:none;background: url(${path}/common/images/pts/radio-2.png) center center no-repeat;background-size:auto 100%;width: 20px;height: 20px;margin-right: 10px;}
+        .all_down{text-decoration: underline;color: #00c;}
     </style>
     <title></title>
 </head>
@@ -581,7 +582,7 @@
                                 <th>收费金额</th>
                                 <th>收费原由</th>
                                 <th>支付渠道</th>
-                                <th>支付账号</th>
+                                <th>交易图片</th>
                                 <th>状态</th>
                                 <th>备注</th>
                                 <th>操作</th>
@@ -610,8 +611,12 @@
                                         <#if informationInfo.feePayChannel == 2>支付宝</#if>
                                         <#if informationInfo.feePayChannel == 3>银行卡</#if>
                                     </#if>
-                                    </td>
-                                    <td>${informationInfo.feePayAccount!''}</td>
+                                </td>
+                                <td>
+                                    <#if informationInfo.feePayPicture?? && informationInfo.feePayPicture!='' >
+                                        <a href="${path}/${informationInfo.feePayPicture!''}" target="_Blank"><img style="width: 75px;" src="${path}/${informationInfo.feePayPicture!''}" ></a>
+                                    </#if>
+                                </td>
                                 <td>
                                     <#if informationInfo.feeStatus??>
                                         <#if informationInfo.feeStatus == 1>代付款</#if>
@@ -686,8 +691,18 @@
                                         </span>
                                     </div>
                                 </div>
+                                <#--<div class="formControls col-5 col-sm-5">-->
+                                    <#--<input type="text" class="input-text" placeholder="填写支付账号" id="feePayAccount" name="feePayAccount">-->
+                                <#--</div>-->
+                            </div>
+                            <div class="row cl">
+                                <div class="formControls col-2 col-sm-2 text-r">
+                                    <strong>交易图片</strong>
+                                </div>
                                 <div class="formControls col-5 col-sm-5">
-                                    <input type="text" class="input-text" placeholder="填写支付账号" id="feePayAccount" name="feePayAccount">
+                                    <input type="file" class="up_file" name="file" id="addFeePayPicture_file" style="display: none">
+                                    <div class="upload_file"><a href="javascript:void(0)" class="del_product all_down"  onclick="fileOnclick(this)">上传交易图片</a></div>
+                                    <input type="hidden" class="addFeePayPicture_img" name="feePayPicture" id="add_feePayPicture" value="" >
                                 </div>
                             </div>
                             <div class="row cl">
@@ -765,8 +780,18 @@
                                         </span>
                                     </div>
                                 </div>
-                                <div class="formControls col-5 col-sm-5">
-                                    <input type="text" class="input-text" placeholder="填写支付账号" id="feePayAccounts" name="feePayAccounts">
+                                <#--<div class="formControls col-5 col-sm-5">-->
+                                    <#--<input type="text" class="input-text" placeholder="填写支付账号" id="feePayAccounts" name="feePayAccounts">-->
+                                <#--</div>-->
+                            </div>
+                            <div class="row cl">
+                                <div class="formControls col-2 col-sm-2 text-r">
+                                    <strong>交易图片</strong>
+                                </div>
+                                <div class="formControls col-5 col-sm-5" id="update_file">
+                                    <input type="file" class="up_file" name="file" id="updateFeePayPicture_file" style="display: none">
+                                    <div class="upload_file"><img style="width: 75px;"  class="fee_file_img  add_file" id="update_file_img"><br><a href="javascript:void(0)" style="padding-left: 10px;" class="del_product all_down" onclick="fileOnclick(this)">重新上传</a></div>
+                                    <input type="hidden" class="addFeePayPicture_img" name="feePayPicture" id="update_feePayPicture" value="" >
                                 </div>
                             </div>
                             <div class="row cl">
@@ -1191,6 +1216,7 @@
 </article>
 <script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
 <script type="text/javascript" src="${path}/common/lib/icheck/jquery.icheck.min.js"></script>
+<script type="text/javascript" src="${path}/common/lib/jquery/1.9.1/ajaxfileupload.js"></script>
 <script type="text/javascript">
     //产品类型
     var productType = null;
@@ -1757,7 +1783,7 @@
         var feeOriginally = $("#feeOriginally").val();
         var feePayChannel = $("#feePayChannel").val();
         var feeCharges = $("#feeCharges").val()*100;
-        var feePayAccount = $("#feePayAccount").val();
+        var feePayPicture = $("#add_feePayPicture").val();
         var feeDesc = $("#feeDesc").val();
         if(feeStatus == null || feeStatus == ""){
             layer.msg("请选择状态!",{icon: 5,time:1000});
@@ -1767,10 +1793,10 @@
             layer.msg("邮费格式不正确,请重新输入!",{icon: 5,time:1000});
             return;
         }
-        if(feePayAccount == null || feePayAccount == ""){
-            layer.msg("请输入支付账号!",{icon: 5,time:1000});
-            return;
-        }
+//        if(feePayAccount == null || feePayAccount == ""){
+//            layer.msg("请输入支付账号!",{icon: 5,time:1000});
+//            return;
+//        }
         $.ajax({
             cache: true,
             type: "POST",
@@ -1779,7 +1805,7 @@
                 "feeOriginally" : feeOriginally,
                 "feePayChannel" : feePayChannel,
                 "feeCharges" : feeCharges,
-                "feePayAccount" : feePayAccount,
+                "feePayPicture" : feePayPicture,
                 "feeDesc" : feeDesc},
             url: "${path}/admin/customer/add_informationInfo",
             async: false,
@@ -1814,13 +1840,19 @@
                     if(informationInfo.feePayChannel == 3){
                         feePayChannel = "银行卡";
                     }
+
+                    var feePayImg = "";
+                    if(isEmpty(feePayPicture)){
+                        feePayImg = '<a href="${path}/'+ feePayPicture +'" target="_Blank"><img style="width: 75px;" src="${path}/'+ feePayPicture +'" ></a>';
+                    }
+
                     $("#trbodyInformationInfoId").append('<tr id="deleteInfoId'+informationInfo.feeId+'"><td>'+informationInfo.feeId+'</td>' +
                             '<td>'+(informationInfo.feeCharges)/100+'</td>' +
                             '<td>'+feeOriginally+'</td>' +
                             '<td>'+feePayChannel+'</td>' +
-                            '<td>'+informationInfo.feePayAccount+'</td>' +
+                            '<td>'+ feePayImg +'</td>' +
                             '<td>'+feeStatus+'</td>' +
-                            '<td>'+informationInfo.feeDesc+'</td>' +
+                            '<td>'+cufte(informationInfo.feeDesc)+'</td>' +
                             '<td><a onclick="deleteInformationInfo('+informationInfo.feeId+');">删除</a>&nbsp&nbsp<a onclick="getInformationInfo('+informationInfo.feeId+');">修改</a></td></tr>');
                     layer.msg("添加成功!",{icon: 1,time:1000});
                 } else {
@@ -1833,7 +1865,7 @@
         })
     }
 
-    /*查询邮费信息*/
+    /*查询信息*/
     function getInformationInfo(feeId) {
         var informationInfo;
         $.ajax({
@@ -1853,9 +1885,26 @@
                     $("#feeChargess").val(informationInfo.feeCharges/100);
                     $("#feeOriginallys").val(informationInfo.feeOriginally);
                     $("#feePayChannels").val(informationInfo.feePayChannel);
-                    $("#feePayAccounts").val(informationInfo.feePayAccount);
+                    //$("#update_file_img").val(informationInfo.feePayPicture);
+
+                    if(isEmpty(informationInfo.feePayPicture)){
+                        var html = '<input type="file" class="up_file" name="file" id="updateFeePayPicture_file" style="display: none">'
+                                + '<div class="upload_file"><img style="width: 75px;" src="${path}/'+ informationInfo.feePayPicture +'"  class="fee_file_img  add_file" id="update_file_img"><br><a href="javascript:void(0)" style="padding-left: 10px;" class="del_product all_down" onclick="fileOnclick(this)">重新上传</a></div>'
+                                + '<input type="hidden" class="addFeePayPicture_img" name="feePayPicture" id="update_feePayPicture" value="'+ informationInfo.feePayPicture +'" >';
+                    }else{
+                        var html = '<input type="file" class="up_file" name="file" id="updateFeePayPicture_file" style="display: none">'
+                                + ' <div class="upload_file"><a href="javascript:void(0)" class="del_product all_down"  onclick="fileOnclick(this)">上传交易图片</a></div>'
+                                + '<input type="hidden" class="addFeePayPicture_img" name="feePayPicture" id="update_feePayPicture" value="'+ cufte(informationInfo.feePayPicture) +'" >';
+                    }
+
+                    $("#update_file").html(html);
+
                     $("#feeDescs").val(informationInfo.feeDesc);
 
+                    $("#updateFeePayPicture_file").change(function() {
+                        fileUpload("updateFeePayPicture_file");
+                    });
+
                 } else {
                     layer.msg("修改失败!",{icon: 5,time:1000});
                 }
@@ -1874,16 +1923,16 @@
         var feeOriginally = $("#feeOriginallys").val();
         var feePayChannel = $("#feePayChannels").val();
         var feeCharges = $("#feeChargess").val()*100;
-        var feePayAccount = $("#feePayAccounts").val();
+        var feePayPicture = $("#update_feePayPicture").val();
         var feeDesc = $("#feeDescs").val();
         if (!money.test(feeCharges)) {
             layer.msg("邮费格式不正确,请重新输入!",{icon: 5,time:1000});
             return;
         }
-        if(feePayAccount == null || feePayAccount == ""){
-            layer.msg("请输入支付账号!",{icon: 5,time:1000});
-            return;
-        }
+//        if(feePayAccount == null || feePayAccount == ""){
+//            layer.msg("请输入支付账号!",{icon: 5,time:1000});
+//            return;
+//        }
         $.ajax({
             cache: true,
             type: "POST",
@@ -1892,7 +1941,7 @@
                 "feeOriginally" : feeOriginally,
                 "feePayChannel" : feePayChannel,
                 "feeCharges" : feeCharges,
-                "feePayAccount" : feePayAccount,
+                "feePayPicture" : feePayPicture,
                 "feeDesc" : feeDesc},
             url: "${path}/admin/customer/update_informationInfo",
             async: false,
@@ -1927,14 +1976,20 @@
                     if(informationInfo.feePayChannel == 3){
                         feePayChannel = "银行卡";
                     }
+
+                    var feePayImg = "";
+                    if(isEmpty(feePayPicture)){
+                        feePayImg = '<a href="${path}/'+ feePayPicture +'" target="_Blank"><img style="width: 75px;" src="${path}/'+ feePayPicture +'" ></a>';
+                    }
+
                     $("#deleteInfoId"+feeId).html("");
                     $("#deleteInfoId"+feeId).append('<td>'+informationInfo.feeId+'</td>' +
                             '<td>'+(informationInfo.feeCharges)/100+'</td>' +
                             '<td>'+feeOriginally+'</td>' +
                             '<td>'+feePayChannel+'</td>' +
-                            '<td>'+informationInfo.feePayAccount+'</td>' +
+                            '<td>'+feePayImg+'</td>' +
                             '<td>'+feeStatus+'</td>' +
-                            '<td>'+informationInfo.feeDesc+'</td>' +
+                            '<td>'+cufte(informationInfo.feeDesc)+'</td>' +
                             '<td><a onclick="deleteInformationInfo('+informationInfo.feeId+');">删除</a>&nbsp&nbsp<a onclick="getInformationInfo('+informationInfo.feeId+');">修改</a></td>');
                     layer.msg("添加成功!",{icon: 1,time:1000});
                 } else {
@@ -3108,6 +3163,47 @@
         $("#updateDetect_3").show();
     });
 
+
+   $(function () {
+       $("#addFeePayPicture_file").change(function() {
+           fileUpload("addFeePayPicture_file");
+       });
+       $("#updateFeePayPicture_file").change(function() {
+           fileUpload("updateFeePayPicture_file");
+       });
+   });
+
+    function fileOnclick(node){
+        $(node).parent().siblings('.up_file').click();
+    }
+
+    /**
+     * 上传交易图片
+     * @param idValue
+     */
+    function fileUpload(idValue) {
+        $.ajaxFileUpload({
+            url:"/admin/customer/fee_fileUpload",
+            secureuri:false,
+            fileElementId : idValue,//文件选择框的id属性/名称
+            dataType: 'json',   //json
+            success: function (data) {
+                if(data.returnCode == 200){
+                    var imghtml = '<img style="width: 75px;" src="/'+ data.returnMsg.imgUrl +'" class="fee_file_img  add_file"><br><a href="javascript:void(0)" style="padding-left: 10px;" class="del_product all_down" onclick="fileOnclick(this)">重新上传</a>';
+
+                    $("#"+idValue).parent().find(".upload_file").eq(0).html(imghtml);
+
+                    $("#"+idValue).change(function() {
+                        fileUpload(idValue);
+                    });
+
+                    $("#"+idValue).parent().find(".addFeePayPicture_img").eq(0).val(data.returnMsg.imgUrl);
+                }else{
+                    layer.msg('上传失败,请重试!',{icon: 5,time:2000});
+                }
+            }
+        });
+    }
 </script>
 </body>
 </html>