Commit 4244f186 by 朱继来

1. 添加终端客户信息;

2. 联营批量导入添加skuid列;
parent 4e79014f
......@@ -76,7 +76,6 @@ Class AddOrderController extends Controller
$data['k2'] = md5(md5($data['k1']).'fh6y5t4rr351d2c3bryi');
$url = Config('website.api_domain').'cart/getDJKConfg';
$info['api_dgk_url'] = ($url.'?k1='.$data['k1']."&".'k2='.$data['k2']);
return view('addOrder', $info);
......@@ -545,6 +544,14 @@ Class AddOrderController extends Controller
$data['tax_id'] = $request->input('tax_id');
$data['user_coupon_id'] = $request->input('user_coupon_id');
if ($data['type'] == 1) { // 联营
$data['customer_cn'] = $request->input('customer_cn', '');
$data['customer_en'] = $request->input('customer_en', '');
$data['customer_type'] = $request->input('customer_type', '');
$data['product_use_classone_sn'] = $request->input('product_use_classone_sn', '');
$data['product_use_classtwo_sn'] = $request->input('product_use_classtwo_sn', '');
}
if ($data['type'] == 4) {
$data['business_type'] = $request->input('business_type');
}
......@@ -729,7 +736,7 @@ Class AddOrderController extends Controller
$excel = $this->handleData($excel, $map); // 处理数据
// 验证excel内容
$valid = $this->excelValid($excel);
$valid = $this->excelValid($excel, $type);
if ($valid['errcode'] != 0) {
errorLog(Error::E_IMPORT_VALID_FAILED, $valid['errmsg']);
......@@ -760,7 +767,7 @@ Class AddOrderController extends Controller
}
// 验证导入excel
public function excelValid($excel)
public function excelValid($excel, $type=1)
{
$count = count($excel);
......@@ -774,9 +781,16 @@ Class AddOrderController extends Controller
$required_keys = array_keys($required); // 必填项keys
$err = ['errcode' => 0, 'errmsg' => '验证成功']; // 提示信息
array_walk($excel, function($val, $key) use($required, $required_keys, &$err) {
array_walk($excel, function($val, $key) use($required, $required_keys, &$err, $type) {
// 跳过第一条
if ($key != 0) {
if ($type == 1) { // 联营
if (strtolower($val['supplier_name']) == 'digikey' && empty($val['id'])) {
$err = ['errcode' => 3, 'errmsg' => '第'.$key.'行,供应商为digikey,SKUID不能为空'];
return;
}
}
foreach ($val as $k=>$v) {
if (in_array($k, $required_keys)) {
if (empty($v)) { // 若必填项值为空,返回提示信息
......
......@@ -57,9 +57,10 @@
3 => 'goods_price',
4 => 'delivery_time',
5 => 'supplier_name',
6 => 'buyer_id',
7 => 'remarks',
8 => 'batch',
6 => 'id',
7 => 'buyer_id',
8 => 'remarks',
9 => 'batch',
],
'self_map' => [
......
......@@ -119,7 +119,7 @@ li {
}
/* 后台新增订单 start */
.user-info, .address-content, .invoice-content, .order-info {
.user-info, .address-content, .invoice-content, .order-info, .client-info {
display: none;
}
......
......@@ -275,17 +275,6 @@
return false;
}
// 检查是否有dgk的商品 如果有就弹出提示框
// console.log(data.supplier_id)
if(resp.data.supplier_id ==7){
//包含digikey的商品
window.is_dgk = 1
}else{
window.is_dgk = 0
}
$('.sku-info').show();
var data = resp.data;
......@@ -662,13 +651,6 @@
// 提交订单
// $('.submit-order').on('click', function() {
$('.submit-order').off().on('click', function() {
//检查有没有digikey的商品 有的话弹出框
if(window.is_dgk == 1){
alert(11);
return false;
}
var self = $(this);
var address_id = $('input[name=address_id]').val();
var type = self.data('type'); // 1-联营线上,2-自营线上,3-自营线下,4-自营其他业务
......@@ -682,9 +664,18 @@
user_id = $('.user_id').val();
}
var is_dgk = false;
$('.shop-table tbody tr').each(function() {
var cid = $(this).data('cid');
cart_ids.push(cid);
var supplier_id = $(this).data('sup_id');
var supplier_name = $(this).data('sup_name');
if (supplier_id == '7' || supplier_name.toLowerCase() == 'digikey') {
is_dgk = true;
}
})
if (cart_ids.length > 0) {
......@@ -722,6 +713,52 @@
}
}
if (type == 1 && is_dgk) { // 联营包含digikey商品,则填写终端资料
var customer_cn = $('.customer_cn').val();
var customer_en = $('.customer_en').val();
var customer_type = $('.customer_type').val();
var product_use_classone_sn = $('.product_use_classone_sn').val();
var product_use_classtwo_sn = $('.product_use_classtwo_sn').val();
if (!customer_cn) {
layer.msg('请填写终端中文名称');
return false;
}
// var cn_reg = /^[\u4e00-\u9fa5]+$/;
// if(!cn_reg.test(customer_cn)){
// layer.msg('请填写全中文名称');
// return false;
// }
if (!customer_en) {
layer.msg('请填写终端英文名称');
return false;
}
// var en_reg = /^[a-zA-Z]+$/;
// if(!en_reg.test(customer_en)){
// layer.msg('请填写全英文名称');
// return false;
// }
if (customer_type == '') {
layer.msg('请选择客户类型');
return false;
}
if (product_use_classone_sn == '') {
layer.msg('请选择产品用户一级分类');
return false;
}
datax.customer_cn = customer_cn;
datax.customer_en = customer_en;
datax.customer_type = customer_type;
datax.product_use_classone_sn = product_use_classone_sn;
datax.product_use_classtwo_sn = product_use_classtwo_sn;
}
datax.tax_id = tax_id;
datax.user_coupon_id = user_coupon_id;
}
......@@ -795,7 +832,7 @@
},
})
layer.msg('订单生成中...', {icon: 16, time: 0, shade: 0.3});
// layer.msg('订单生成中...', {icon: 16, time: 0, shade: 0.3});
}
} else {
layer.msg('请先添加商品');
......@@ -825,7 +862,7 @@
if (len > 0) {
// 购物车列表
for (var i = 0; i < len; i++) {
html += '<tr data-cid="'+list[i].cart_id+'" data-type="'+list[i].type+'" min_buy="'+list[i].min_buy+'">'+
html += '<tr data-cid="'+list[i].cart_id+'" data-type="'+list[i].type+'" min_buy="'+list[i].min_buy+'" data-sup_name="'+list[i].supplier_name+'" data-sup_id="'+list[i].supplier_id+'">'+
'<td>'+(i+1)+'</td>'+
'<td class="goods_id">'+list[i].goods_id+'</td>'+
'<td>'+list[i].goods_name+'</td>'+
......@@ -981,6 +1018,23 @@
}
}
if (goods_type == 1) {
var list = resp.data.list;
var is_dgk = false;
for (var i = 0; i < list.length; i++) {
if (list[i].supplier_id == '7' || list[i].supplier_name.toLowerCase() == 'digikey') {
is_dgk = true;
}
}
if (is_dgk) {
$('.client-info').css('display', 'block');
} else {
$('.client-info').css('display', 'none');
}
}
if (data.extend_fee) {
$('.extend_fee').show();
$('.extend_fee_val').empty().text(data.extend_fee_format); // 附加费
......@@ -1003,65 +1057,6 @@
},
}
});
setTimeout( function(){
$.get(window.api_dgk_url_text,function(data){
window.data = data.data.data
console.log(window.data)
//循环第一级
// console.log(Object.keys(window.data).length)
product_len = Object.keys(window.data).length
for(let key in window.data){
// console.log(key)
// console.log(window.data[key])
$('.product_one').append('<option class="product_one_select" >'+key+' </option>')
}
},'json')
}, 10 )
$(document).on('change','.product_one',function(data){
var select_key = $('.product_one option:selected').val()
// console.log(select_key)
$('.product_two').html('')
for(let key in window.data){
if(key == select_key){
console.log('找到')
console.log(window.data[key])
console.log(window.data[key].length)
for(i=0 ; i<window.data[key].length ;i++){
$('.product_two').append('<option class="" >'+window.data[key][i]+' </option>')
}
}
}
})
// $('')
})(jQuery)
//获取url中的参数
......
......@@ -228,49 +228,51 @@
</div>
</div>
<div class="client-info">
<h4>终端客户信息 <span class="title-tips"><i class="fa fa-info-circle"></i>digikey渠道商品必填,其他渠道可不填写</span></h4>
<div class="delivery-info">
<span> 终端名称 </span> <input type="text" class="search-sku" name="client_name" value="" placeholder="">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 终端中文名称:</span>
<input type="text" class="customer_cn" name="customer_cn" value="">
</div>
</div>
<!-- <span> 终端名称 </span> <input type="text" class="search-sku" name="client_name" value="" placeholder=""> -->
&nbsp;&nbsp;&nbsp;&nbsp;
<span> 客户类型 </span>:
<select class="layui-select">
<option>请选择</option>
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 客户类型:</span>
<select class="layui-select customer_type" name="customer_type">
<option value="">请选择</option>
<option value="1">终端</option>
<option value="2">贸易商</option>
<option value="3">大学</option>
<option value="4">个人</option>
</select>
</div>
</div>
</div>
<br/>
<div class="delivery-info">
<span> 终端名称</span> <input type="text" class="search-sku" name="client_name" value="" placeholder="">
<!-- <span> 终端名称 </span> <input type="text" class="search-sku" name="client_name" value="" placeholder=""> -->
&nbsp;&nbsp;&nbsp;&nbsp;
<span> 产品用途 </span>:
<select class="layui-select product_one">
<option>请选择</option>
</select>
<select class="layui-select product_two">
<div class="row">
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 终端英文名称:</span>
<input type="text" class="customer_en" name="customer_en" value="">
</div>
</div>
<div class="col-sm-6">
<div class="form-group">
<span><i class="text-danger">*</i> 产品用途:</span>
<select class="layui-select product_use_classone_sn" name="product_use_classone_sn">
<option value="">请选择</option>
</select>
<select class="layui-select product_use_classtwo_sn" name="product_use_classtwo_sn"></select>
</div>
</div>
</div>
</div>
</div>
</div>
......@@ -291,7 +293,7 @@
<div class="batch-btn">
<a class="btn btn-success goods_import" data-type="1">批量导入物料</a>
<a class="btn btn-info" href="http://img.ichunt.com/doc/excel/template/%E8%81%94%E8%90%A5%E8%AE%A2%E5%8D%95%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.csv">联营物料模板下载</a>
<a class="btn btn-info" href="http://img.ichunt.com/doc/excel/template/%E8%81%94%E8%90%A5%E6%89%B9%E9%87%8F%E5%AF%BC%E5%85%A5%E6%A8%A1%E6%9D%BF.csv">联营物料模板下载</a>
</div>
</div>
</div>
......@@ -450,6 +452,34 @@
var role = "{{ $role }}";
window.api_dgk_url_text ="<?php echo $api_dgk_url;?>"
setTimeout( function(){
$.get(window.api_dgk_url_text,function(data){
window.data = data.data.data
console.log(window.data)
var product = Object.keys(window.data); // 获取一级分类
var product_len = Object.keys(window.data).length
for(var i = 0; i < product_len; i++){
$('.product_use_classone_sn').append('<option value="'+i+'">'+product[i]+'</option>')
}
},'json')
}, 10)
$(document).on('change','.product_use_classone_sn',function(data){
var select_key = $('.product_use_classone_sn option:selected').text();
$('.product_use_classtwo_sn').html('');
for(let key in window.data){
if(key == select_key){
// console.log(window.data[key])
for(var i = 0; i < window.data[key].length; i++){
$('.product_use_classtwo_sn').append('<option value="'+i+'">'+window.data[key][i]+'</option>')
}
}
}
})
$.lie.add_order.lyorder();
</script>
\ No newline at end of file
......@@ -463,6 +463,7 @@
<th>商品名</th>
<th>型号</th>
@else
<th>商品ID</th>
<th>商品名</th>
@endif
......@@ -529,6 +530,7 @@
<td><a href="{{Config('website.main_url').'item/'.$v['goods_id'].'.html?ptag=order'}}" target="_blank">{{$v['goods_name']}}</a></td>
<td>{{ App\Http\Controllers\getGoodsName($v['goods_id']) }}</td>
@else
<td>{{$v['goods_id']}}</td>
<td><a href="{{Config('website.main_url').'goods_'.$v['goods_id'].'.html?ptag=order'}}" target="_blank">{{$v['goods_name']}}</a></td>
@endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or sign in to comment