|
@@ -77,7 +77,6 @@
|
|
|
</div>
|
|
|
|
|
|
<#if admin.adminDept == 3 || admin.adminDept == 1>
|
|
|
-
|
|
|
<div class="row cl sales_channel" id="" style="">
|
|
|
<label class="form-label col-1 col-sm-1">销售渠道:</label>
|
|
|
<div class="formControls col-2 col-sm-2" style="">
|
|
@@ -93,10 +92,8 @@
|
|
|
</span>
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
</#if>
|
|
|
|
|
|
-
|
|
|
<div class="row cl" id="" style="">
|
|
|
<label class="form-label col-1 col-sm-1">用户信息:</label>
|
|
|
<div class="formControls col-2 col-sm-2">
|
|
@@ -171,7 +168,6 @@
|
|
|
<label class="form-label col-1 col-sm-1">商品信息:</label>
|
|
|
<div class="formControls col-8 col-sm-8">
|
|
|
<input type="button" class="btn btn-primary add-order-button" onclick="add_product()" value="添加商品" >
|
|
|
-
|
|
|
<table class="table table-border table-bg table-bordered" style="margin-top: 10px;display: none" id="all_add_product">
|
|
|
<thead>
|
|
|
<tr class="text-c" id="table1">
|
|
@@ -186,9 +182,7 @@
|
|
|
<tbody id="add_product">
|
|
|
</tbody>
|
|
|
</table>
|
|
|
-
|
|
|
<input type="hidden" id="orderItemString" name="orderItemString" value="" >
|
|
|
-
|
|
|
</div>
|
|
|
</div>
|
|
|
|
|
@@ -247,9 +241,12 @@
|
|
|
</div>
|
|
|
</article>
|
|
|
|
|
|
-
|
|
|
+<script type="text/javascript">
|
|
|
+ var url_path = "${path}";
|
|
|
+</script>
|
|
|
<#--时间控件-->
|
|
|
<script type="text/javascript" src="${path}/common/lib/My97DatePicker/4.8/WdatePicker.js"></script>
|
|
|
+<script type="text/javascript" charset="utf-8" src="${path}/common/js/salesOrder/salesOrder.js"></script>
|
|
|
|
|
|
<script type="text/javascript">
|
|
|
var url_path = "${path}";
|
|
@@ -270,169 +267,6 @@
|
|
|
/*初始化销售公司店铺*/
|
|
|
$(".sales_channel").initSalesChannel();
|
|
|
|
|
|
- /**
|
|
|
- * 打开订单
|
|
|
- */
|
|
|
- function add_product() {
|
|
|
- layer_show("商品列表",url_path + "/admin/salesOrder/to_add_product","1000","500");
|
|
|
- }
|
|
|
-
|
|
|
- $(function(){
|
|
|
- $("#form-order-add").Validform({
|
|
|
- tiptype: function (msg, o, cssctl) {
|
|
|
- if (o.type == 3) {//失败
|
|
|
- layer.msg(msg, {icon: 5, time: 3000});
|
|
|
- $(window).scrollTop(o.obj.offset().top - 40);
|
|
|
- }
|
|
|
- },
|
|
|
- datatype: {//自定义验证类型
|
|
|
- },
|
|
|
- ignoreHidden: true,
|
|
|
- tipSweep: true, //若为true,则只在表单提交时验证
|
|
|
- ajaxPost: true, //异步提交
|
|
|
- beforeCheck: function (curform) { //验证通过之前执行的函数
|
|
|
- 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;
|
|
|
- })
|
|
|
- if(!flag){
|
|
|
- vailErrorMsg($(".add-order-button"),"必须要有一个产品");
|
|
|
- return false;
|
|
|
- }
|
|
|
-
|
|
|
- $("#orderItemString").val(JSON.stringify(orderItemArray));
|
|
|
-
|
|
|
- var index = layer.load(1, {
|
|
|
- shade: [0.5,'#fff'] //0.1透明度的白色背景
|
|
|
- });
|
|
|
- },
|
|
|
- callback: function (data) {//异步回调函数
|
|
|
- if (data) {
|
|
|
- var index = layer.alert(data.resultMsg, function (index) {
|
|
|
- if (data.resultCode == 200) {
|
|
|
- location.href = url_path + "/admin/salesOrder/list_order_page";
|
|
|
- }else {
|
|
|
- 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: "${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" 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);
|
|
|
- }
|
|
|
|
|
|
</script>
|
|
|
</body>
|