|
@@ -1,35 +1,50 @@
|
|
|
|
|
|
-var allCustomerId = "";
|
|
|
-
|
|
|
+var colorNum = "COLOR_NUM";
|
|
|
+
|
|
|
+var color = new Object();
|
|
|
+color.num = 0; //标志颜色数量
|
|
|
+color.html = '<tr class="color_list">'
|
|
|
+ + '<td style="text-align: center;" width="30" > <input type="text" class="input-text input-number item-num" value="" name="colorName" id="" placeholder="颜色名称" datatype="*1-32" errormsg="颜色名称格式不正确!"></td>'
|
|
|
+ + '<td style="text-align: center;" width="25" ><input type="text" class="input-text input-number item-num" value="" name="colorAbbreviation" id="" placeholder="颜色简称" datatype="*1-15" errormsg="颜色简称格式不正确!"></td>'
|
|
|
+ + '<td style="text-align: center;" width="10"><input type="text" class="input-text input-number item-num" value="0" name="colorDiscount" id="" style="width: 100%;text-align: center;" placeholder="售价" onkeyup="keyFun($(this),9999,1)" onpaste="keyFun($(this),9999,1)"></td>'
|
|
|
+ + '<td style="text-align: center;" width="10"><input type="text" class="input-text input-number item-num" value="0" name="colorPrice" id="" style="width: 100%;text-align: center;" placeholder="原价" onkeyup="keyFun($(this),9999,1)" onpaste="keyFun($(this),9999,1)"></td>'
|
|
|
+ + '<td style="text-align: center;" width="10"><input type="text" class="input-text input-number item-num" value="" name="colorBar" id="" placeholder="69码" datatype="*1-20" errormsg="69码格式不正确!"></td>'
|
|
|
+ + '<td style="text-align: center;" width="10"><input type="text" class="input-text input-number item-num" value="0" name="colorIsWeight" id="" style="width: 100%;text-align: center;" placeholder="重量" onkeyup="keyFun($(this),9999,1)" onpaste="keyFun($(this),9999,1)"></td>'
|
|
|
+ + '<td style="text-align: center;" width="10"><select class="select" id="" name="colorIsMachine" > <option value="1" >是</option><option value="1" >否</option></select></td>'
|
|
|
+ + '<td style="text-align: center;" width="10"><input type="file" class="color_file" name="file" id="fileId_'+ colorNum +'" style="display: none">'
|
|
|
+ + '<a href="javascript:void(0)" class="del_product all_down" onclick="fileOnclick(this)">上传图片</a>'
|
|
|
+ + '<input name="colorPicture" style="display: none;"></td>'
|
|
|
+ + '<td style="text-align: center;" width="10"> <a href="javascript:void(0)" class="del_product all_down" onclick="delTr($(this))" >删除</a></td>'
|
|
|
+ + '</tr>';
|
|
|
|
|
|
/**
|
|
|
- * 打开商品列表
|
|
|
+ *
|
|
|
*/
|
|
|
-function add_product() {
|
|
|
- layer_show("商品列表",url_path + "/admin/salesOrder/to_add_product","1000","500");
|
|
|
+function getColorHtml(){
|
|
|
+ return color.html.replace(colorNum,color.num);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
- * 打开客诉列表
|
|
|
+ * 添加颜色
|
|
|
*/
|
|
|
-function add_customer() {
|
|
|
- layer_show("客诉列表",url_path + "/admin/customer/to_add_customer_list","1000","500");
|
|
|
+function add_color(){
|
|
|
+ color.num++;
|
|
|
+ $("#add_color").append(getColorHtml());
|
|
|
+
|
|
|
+ $("#fileId_"+color.num).change(function() {
|
|
|
+ fileUpload();
|
|
|
+ });
|
|
|
+}
|
|
|
+
|
|
|
+function fileOnclick(node){
|
|
|
+ $(node).siblings('.color_file').click();
|
|
|
+ $("#fileId_"+color.num).change(function() {
|
|
|
+ fileUpload("fileId_" + color.num);
|
|
|
+ });
|
|
|
}
|
|
|
|
|
|
$(function(){
|
|
|
- $("#salesOrderStatus").change(function(){
|
|
|
- var status = $(this).val();
|
|
|
- if(status == 1){ //正常订单
|
|
|
- $("#selectCustomer").hide();
|
|
|
- $("#salesCustomer").hide();
|
|
|
- $("#salesCustomerIdHtml").html("");
|
|
|
- $("#salesCustomerId").val("");
|
|
|
- }else{
|
|
|
- $("#selectCustomer").show();
|
|
|
- $("#salesCustomer").show();
|
|
|
- $("#salesCustomerIdHtml").html("未选择客诉编号!");
|
|
|
- }
|
|
|
- })
|
|
|
+ $("#add_color").append(getColorHtml());
|
|
|
})
|
|
|
|
|
|
$(function(){
|
|
@@ -50,29 +65,18 @@ $(function(){
|
|
|
var flag = false;
|
|
|
},
|
|
|
beforeSubmit: function (curform) { //验证通过之后执行的函数
|
|
|
- var addressProvince = $("#addressProvince").find("option:selected").text();
|
|
|
- var addressCity = $("#addressCity").find("option:selected").text();
|
|
|
- var addressCountry = $("#addressCountry").find("option:selected").text();
|
|
|
- var addressDesc = $("#addressDesc").val();
|
|
|
- var salesAddressInfo = addressProvince + " " + addressCity + " " + addressCountry + " " + addressDesc
|
|
|
- $("#salesAddressInfo").val(salesAddressInfo);
|
|
|
|
|
|
- var flag = false;
|
|
|
- /*封装订单项*/
|
|
|
- var orderItemArray = new Array();
|
|
|
- $("#add_product").find("tr").each(function(){
|
|
|
- var orderItem = new Object();
|
|
|
- orderItem.itemColorId = $(this).find(".color_id").val();
|
|
|
- orderItem.itemNum = $(this).find(".item-num").val();
|
|
|
- orderItemArray.push(orderItem);
|
|
|
- flag = true;
|
|
|
+ var colorList = new Array();
|
|
|
+ $("#add_color").find(".color_list").each(function(){
|
|
|
+ var color = new Object();
|
|
|
+ $(this).find("input").each(function(){
|
|
|
+ var inputName = $(this).attr("name");
|
|
|
+ color[inputName] = $(this).val()
|
|
|
+ })
|
|
|
+ colorList.push(color);
|
|
|
})
|
|
|
- if(!flag){
|
|
|
- vailErrorMsg($(".add-order-button"),"必须要有一个产品");
|
|
|
- return false;
|
|
|
- }
|
|
|
|
|
|
- $("#orderItemString").val(JSON.stringify(orderItemArray));
|
|
|
+ $("#colorListJson").val(JSON.stringify(colorList));
|
|
|
|
|
|
loadIndex = layer.load(1, {
|
|
|
shade: [0.5,'#fff'] //0.1透明度的白色背景
|
|
@@ -98,134 +102,26 @@ $(function(){
|
|
|
|
|
|
|
|
|
/**
|
|
|
- * 客诉回调
|
|
|
- * @param colorIds
|
|
|
+ * 删除商品
|
|
|
*/
|
|
|
-function setSelectCustomer(customerId){
|
|
|
- var index = layer.load(1, {
|
|
|
- shade: [0.5,'#fff'] //0.1透明度的白色背景
|
|
|
- });
|
|
|
-
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- data: { customerId : customerId},
|
|
|
- url: url_path +"/admin/customer/get_customer_info",
|
|
|
- success: function(data){
|
|
|
- if (data.returnCode == 200 && data.returnMsg.customer != null ) {
|
|
|
- var customer = data.returnMsg.customer;
|
|
|
- $("#salesCustomerIdHtml").html("已经选择客诉记录:"+customer.customerId);
|
|
|
- $("#salesCustomerId").val(customer.customerId);
|
|
|
- sc.setCompanyId(customer.companyId);
|
|
|
- sc.setStoreId(customer.storeId);
|
|
|
- /*设置用户姓名、电话*/
|
|
|
- $("#salesAddressName").val(customer.customerName);
|
|
|
- $("#salesAddressTel").val(customer.customerTel);
|
|
|
- /* 售后订单的支付时间、支付方式默认 */
|
|
|
- $("#salesPayTime").val(customer.salesTime);
|
|
|
+function delTr($this){
|
|
|
+ color.num++;
|
|
|
+ $this.parents("tr").remove();
|
|
|
+}
|
|
|
|
|
|
+function fileUpload(nodo) {
|
|
|
+ $.ajaxFileUpload({
|
|
|
+ url:"/admin/product/fileUpload",
|
|
|
+ secureuri:false,
|
|
|
+ fileElementId : nodo,//文件选择框的id属性
|
|
|
+ dataType: 'json', //json
|
|
|
+ success: function (data) {
|
|
|
+ if(data.returnCode == 200){
|
|
|
+ $("#"+nodo)
|
|
|
+ $("#fileDiv").prepend('<input type="file" name="file" id="fileid" style="opacity: 0; position: absolute; width: 90px;height: 80px;" onchange="fileUpload()">');
|
|
|
}else{
|
|
|
+ layer.msg('上传失败,请重试!',{icon: 5,time:2000});
|
|
|
}
|
|
|
- $("#salesCustomer").show();
|
|
|
}
|
|
|
});
|
|
|
- layer.close(index);
|
|
|
}
|
|
|
-
|
|
|
-
|
|
|
-/**
|
|
|
- * 选择商品回调
|
|
|
- * @param colorIds
|
|
|
- */
|
|
|
-function setSelectProduct(colorIds){
|
|
|
- var index = layer.load(1, {
|
|
|
- shade: [0.5,'#fff'] //0.1透明度的白色背景
|
|
|
- });
|
|
|
-
|
|
|
- $("#all_add_product").show();
|
|
|
-
|
|
|
- var colorIdArray = colorIds.split("_");
|
|
|
- for(var i=0;i<colorIdArray.length;i++){
|
|
|
- var colorId = colorIdArray[i];
|
|
|
- if(colorId == ""){
|
|
|
- break;
|
|
|
- }
|
|
|
-
|
|
|
- var flag = true;
|
|
|
- $("#add_product").find("tr").each(function (){
|
|
|
- var colId = $(this).find(".color_id").eq(0).val();
|
|
|
- if(colId == colorId){
|
|
|
- flag = false;
|
|
|
- }
|
|
|
- })
|
|
|
- if(!flag){
|
|
|
- continue;
|
|
|
- }
|
|
|
- $.ajax({
|
|
|
- type: "POST",
|
|
|
- data: { colorId : colorId},
|
|
|
- url: url_path +"/admin/product/get_product",
|
|
|
- success: function(data){
|
|
|
- var html = "";
|
|
|
- if (data.returnCode == 200 && data.returnMsg.productColorList.length > 0 ) {
|
|
|
- for(var i=0;i<data.returnMsg.productColorList.length;i++){
|
|
|
- var productColor = data.returnMsg.productColorList[i];
|
|
|
- html += '<tr class="text-c">' +
|
|
|
- '<input type="hidden" class="color_id" id="" value="'+ productColor.colorId +'" >' +
|
|
|
- '<input type="hidden" class="color_price" id="" value="'+ productColor.colorPrice +'" >' +
|
|
|
- '<input type="hidden" class="color_discount" id="" value="'+ productColor.colorDiscount +'" >' +
|
|
|
- ' <td>'+ cufte(productColor.productName) +'</td>' +
|
|
|
- ' <td>'+ cufte(productColor.colorName) +'</td>' +
|
|
|
- ' <td>'+ cufte(productColor.colorPrice)/100 +'</td>' +
|
|
|
- ' <td>'+ cufte(productColor.colorBar) +'</td>' +
|
|
|
- ' <td><input type="text" class="input-text input-number item-num" value="1" style="width: 100%;border: none;text-align: center;" name="" id="" placeholder="产品数量" onkeyup="keyFun($(this),999,1)" onpaste="keyFun($(this),999,1)"></td>' +
|
|
|
- ' <td><a href="javascript:void(0)" class="del_product all_down" onclick="delProduct($(this))" >删除</a></td>' +
|
|
|
- ' </tr>';
|
|
|
- }
|
|
|
- }else{
|
|
|
- html = '<tr class="text-c"><td colspan="12">没有搜索到商品,请重试!</td></tr>';
|
|
|
- }
|
|
|
- $("#add_product").append(html);
|
|
|
- /*计算价格*/
|
|
|
- calculatePrice();
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
- layer.close(index);
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * 删除商品
|
|
|
- */
|
|
|
-function delProduct($this){
|
|
|
- $this.parents("tr").remove();
|
|
|
-}
|
|
|
-
|
|
|
-/**
|
|
|
- * 计算价格
|
|
|
- */
|
|
|
-function calculatePrice(){
|
|
|
- /*总价,折扣价,优惠金额*/
|
|
|
- var colorDiscountAll = 0,colorPriceAll = 0,salesPayMoneyAll=0;
|
|
|
- $("#add_product").find("tr").each(function(){
|
|
|
- var colorDiscount = 0,colorPrice = 0,salesPayMoney=0,itemNum=0;
|
|
|
- colorDiscount = parseInt($(this).find(".color_discount").val())/100;
|
|
|
- colorPrice = parseInt($(this).find(".color_price").val())/100;
|
|
|
- itemNum = $(this).find(".item-num").val();
|
|
|
- if(!isEmpty(itemNum)){
|
|
|
- return;
|
|
|
- }
|
|
|
- itemNum = parseInt(itemNum);
|
|
|
- salesPayMoney = colorPrice -colorDiscount;
|
|
|
- if(salesPayMoney < 0){
|
|
|
- salesPayMoney = 0;
|
|
|
- }
|
|
|
- colorDiscountAll += colorDiscount*itemNum;
|
|
|
- colorPriceAll += colorPrice*itemNum;
|
|
|
- salesPayMoneyAll += salesPayMoney*itemNum;
|
|
|
- })
|
|
|
- $("#salesAmount").val(colorPriceAll);
|
|
|
- $("#salesPayMoney").val(colorDiscountAll);
|
|
|
- $("#salesDiscountMoney").val(salesPayMoneyAll);
|
|
|
-
|
|
|
- $("#salesLastMoney").val(colorDiscountAll);
|
|
|
-}
|