Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
朱继来
/
后台订单管理
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Settings
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
5d6f7776
authored
Mar 17, 2021
by
朱继来
Browse files
Options
_('Browse Files')
Download
Email Patches
Plain Diff
导入销售报价
parent
9a1c7220
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
138 additions
and
10 deletions
app/Http/Controllers/AddOrderController.php
app/Http/Controllers/ApiController.php
app/Model/Frq/InquiryItemsReportModel.php
config/database.php
public/js/add_order.js
resources/views/addOrder/content.blade.php
app/Http/Controllers/AddOrderController.php
View file @
5d6f7776
...
@@ -61,10 +61,7 @@ Class AddOrderController extends Controller
...
@@ -61,10 +61,7 @@ Class AddOrderController extends Controller
$info
=
$this
->
getPageInfo
(
$request
);
$info
=
$this
->
getPageInfo
(
$request
);
$info
[
'title'
]
=
'新增联营订单'
;
$info
[
'title'
]
=
'新增联营订单'
;
$info
[
'sale_id'
]
=
$request
->
user
->
userId
;
$crm_user_id
=
$request
->
input
(
'user_id'
,
0
);
$crm_user_id
=
$request
->
input
(
'user_id'
,
0
);
$info
[
'crm_account'
]
=
''
;
$info
[
'crm_account'
]
=
''
;
if
(
$crm_user_id
)
{
if
(
$crm_user_id
)
{
...
@@ -78,8 +75,9 @@ Class AddOrderController extends Controller
...
@@ -78,8 +75,9 @@ Class AddOrderController extends Controller
$url
=
Config
(
'website.api_domain'
)
.
'cart/getDJKConfg'
;
$url
=
Config
(
'website.api_domain'
)
.
'cart/getDJKConfg'
;
$info
[
'api_dgk_url'
]
=
(
$url
.
'?k1='
.
$data
[
'k1'
]
.
"&"
.
'k2='
.
$data
[
'k2'
]);
$info
[
'api_dgk_url'
]
=
(
$url
.
'?k1='
.
$data
[
'k1'
]
.
"&"
.
'k2='
.
$data
[
'k2'
]);
$info
[
'company'
]
=
(
new
CmsModel
())
->
getCompany
();
// 获取公司组织
$info
[
'company'
]
=
(
new
CmsModel
())
->
getCompany
();
// 获取公司组织
$info
[
'report_ids'
]
=
$request
->
input
(
'report_ids'
,
''
);
// 询价系统销售报价ID
return
view
(
'addOrder'
,
$info
);
return
view
(
'addOrder'
,
$info
);
}
}
...
...
app/Http/Controllers/ApiController.php
View file @
5d6f7776
...
@@ -31,6 +31,7 @@ use App\Model\OrderServiceLogModel;
...
@@ -31,6 +31,7 @@ use App\Model\OrderServiceLogModel;
use
App\Model\OrderRefundModel
;
use
App\Model\OrderRefundModel
;
use
App\Model\OrderRefundLogModel
;
use
App\Model\OrderRefundLogModel
;
use
DB
;
use
DB
;
use
App\Model\Frq\InquiryItemsReportModel
;
class
ApiController
extends
Controller
class
ApiController
extends
Controller
{
{
...
@@ -623,5 +624,61 @@ class ApiController extends Controller
...
@@ -623,5 +624,61 @@ class ApiController extends Controller
return
DB
::
connection
(
'order'
)
->
table
(
'lie_region'
)
->
where
(
'region_id'
,
$id
)
->
value
(
'region_name'
);
return
DB
::
connection
(
'order'
)
->
table
(
'lie_region'
)
->
where
(
'region_id'
,
$id
)
->
value
(
'region_name'
);
}
}
// 导入销售报价物料
public
function
importGoods
(
$request
)
{
$user_id
=
$request
->
input
(
'user_id'
,
0
);
$report_ids
=
$request
->
input
(
'report_ids'
,
''
);
if
(
!
$user_id
||
!
$report_ids
)
$this
->
Export
(
-
1
,
'参数缺失'
);
$report_ids
=
explode
(
','
,
$report_ids
);
$InquiryItemsReportModel
=
new
InquiryItemsReportModel
;
$inquiry
=
$InquiryItemsReportModel
->
getData
(
$report_ids
);
if
(
empty
(
$inquiry
))
$this
->
Export
(
-
2
,
'未获取到销售报价明细'
);
$items
=
[];
foreach
(
$inquiry
as
$k
=>
$v
)
{
$goods_price
=
$v
[
'currency'
]
==
1
?
$v
[
'price_rmb'
]
:
$v
[
'price_origin'
];
if
(
$goods_price
<=
0
)
$this
->
Export
(
-
3
,
'导入销售报价明细,商品:'
.
$v
[
'goods_name'
]
.
' 单价不能为0'
);
if
(
$v
[
'inquiry_number'
]
<=
0
)
$this
->
Export
(
-
3
,
'导入销售报价明细,商品:'
.
$v
[
'goods_name'
]
.
' 数量不能为0'
);
$items
[
$k
][
'id'
]
=
$v
[
'goods_id'
];
$items
[
$k
][
'goods_name'
]
=
$v
[
'goods_name'
];
$items
[
$k
][
'brand_name'
]
=
$v
[
'brand_name'
];
$items
[
$k
][
'supplier_name'
]
=
$v
[
'supplier_name'
];
$items
[
$k
][
'num'
]
=
$v
[
'inquiry_number'
];
$items
[
$k
][
'goods_price'
]
=
$goods_price
;
$items
[
$k
][
'delivery_time'
]
=
$v
[
'delivery_time'
];
$items
[
$k
][
'buyer_id'
]
=
0
;
$items
[
$k
][
'remarks'
]
=
''
;
$items
[
$k
][
'batch'
]
=
$v
[
'batch'
];
$items
[
$k
][
'raw_goods_sn'
]
=
$v
[
'raw_goods_sn'
];
$items
[
$k
][
'raw_goods_packing'
]
=
$v
[
'raw_goods_packing'
];
$items
[
$k
][
'raw_brand_name'
]
=
$v
[
'raw_brand_name'
];
}
$delivery_place
=
$inquiry
[
0
][
'currency'
]
==
1
?
1
:
2
;
// 推送到API
$data
[
'data'
]
=
$items
;
$data
[
'operator_id'
]
=
$request
->
user
->
userId
;
$data
[
'operator_name'
]
=
$request
->
user
->
name
;
$data
[
'type'
]
=
4
;
// 批量导入销售报价
$data
[
'uid'
]
=
$user_id
;
$data
[
'delivery_place'
]
=
$delivery_place
;
$url
=
Config
(
'website.api_domain'
)
.
'cart/addBatchByOrderSystem'
;
$data
[
'k1'
]
=
time
();
$data
[
'k2'
]
=
md5
(
md5
(
$data
[
'k1'
])
.
'fh6y5t4rr351d2c3bryi'
);
$temp
=
json_decode
(
curlApi
(
$url
,
$data
,
"POST"
),
true
);
$this
->
Export
(
$temp
[
'err_code'
],
$temp
[
'err_msg'
]);
}
}
}
app/Model/Frq/InquiryItemsReportModel.php
0 → 100644
View file @
5d6f7776
<?php
namespace
App\Model\Frq
;
use
Illuminate\Database\Eloquent\Model
;
class
InquiryItemsReportModel
extends
Model
{
protected
$connection
=
'frq'
;
protected
$table
=
'inquiry_items_report'
;
protected
$primaryKey
=
'id'
;
public
$timestamps
=
false
;
// 获取指定销售报价
public
function
getData
(
$id
)
{
if
(
is_array
(
$id
))
return
$this
->
whereIn
(
'id'
,
$id
)
->
get
()
->
toArray
();
return
$this
->
where
(
'id'
,
$id
)
->
first
();
}
}
\ No newline at end of file
config/database.php
View file @
5d6f7776
...
@@ -109,6 +109,7 @@ return [
...
@@ -109,6 +109,7 @@ return [
'prefix'
=>
'lie_'
,
'prefix'
=>
'lie_'
,
'strict'
=>
false
,
'strict'
=>
false
,
],
],
'bom'
=>
[
'bom'
=>
[
'driver'
=>
'mysql'
,
'driver'
=>
'mysql'
,
'host'
=>
env
(
'DB_HOST_BOM'
,
''
),
'host'
=>
env
(
'DB_HOST_BOM'
,
''
),
...
@@ -121,6 +122,20 @@ return [
...
@@ -121,6 +122,20 @@ return [
'prefix'
=>
'lie_'
,
'prefix'
=>
'lie_'
,
'strict'
=>
false
,
'strict'
=>
false
,
],
],
'frq'
=>
[
'driver'
=>
'mysql'
,
'host'
=>
env
(
'DB_HOST_RFQ'
,
''
),
'database'
=>
env
(
'DB_DATABASE_RFQ'
,
''
),
'username'
=>
env
(
'DB_USERNAME_RFQ'
,
''
),
'password'
=>
env
(
'DB_PASSWORD_RFQ'
,
''
),
'port'
=>
env
(
'DB_PORT_RFQ'
,
3306
),
'charset'
=>
'utf8'
,
'collation'
=>
'utf8_unicode_ci'
,
'prefix'
=>
'lie_'
,
'strict'
=>
false
,
],
'sqlite'
=>
[
'sqlite'
=>
[
'driver'
=>
'sqlite'
,
'driver'
=>
'sqlite'
,
'database'
=>
database_path
(
'database.sqlite'
),
'database'
=>
database_path
(
'database.sqlite'
),
...
...
public/js/add_order.js
View file @
5d6f7776
...
@@ -21,7 +21,7 @@ layui.config({
...
@@ -21,7 +21,7 @@ layui.config({
// 公司、账号输入后,赋值ID,并检查绑定客服、发票
// 公司、账号输入后,赋值ID,并检查绑定客服、发票
$
(
'.inv-user-info'
).
blur
(
function
()
{
$
(
'.inv-user-info'
).
blur
(
function
()
{
var
val
=
$
(
this
).
val
();
var
val
=
$
(
this
).
val
();
var
type
=
$
(
this
).
data
(
'type'
);
// 1-公司,2-会员账号
var
type
=
$
(
this
).
data
(
'type'
);
// 1-公司,2-会员账号
if
(
!
val
)
return
false
;
if
(
!
val
)
return
false
;
...
@@ -40,6 +40,12 @@ layui.config({
...
@@ -40,6 +40,12 @@ layui.config({
$
(
'.'
+
field
).
val
(
resp
.
data
);
$
(
'.'
+
field
).
val
(
resp
.
data
);
checkBindUser
();
checkBindUser
();
if
(
type
==
2
&&
resp
.
data
&&
report_ids
)
{
// 会员ID、销售报价ID存在
importGoods
(
resp
.
data
,
report_ids
);
return
false
;
}
renderTable
();
renderTable
();
}
}
})
})
...
@@ -118,6 +124,30 @@ layui.config({
...
@@ -118,6 +124,30 @@ layui.config({
},
},
})
})
}
}
// importGoods(70132, '48,49');
// 导入销售报价的物料
function
importGoods
(
user_id
,
report_ids
)
{
var
datax
=
{};
datax
.
user_id
=
user_id
;
datax
.
report_ids
=
report_ids
;
$
.
ajax
({
type
:
"POST"
,
url
:
'/api/importGoods'
,
data
:
datax
,
dataType
:
"json"
,
success
:
function
(
resp
){
if
(
resp
.
errcode
!=
0
)
{
layer
.
alert
(
resp
.
errmsg
);
return
false
;
}
layer
.
msg
(
'导入销售报价明细成功'
);
renderTable
();
}
})
}
// 选择个人发票
// 选择个人发票
form
.
on
(
'select(user_tax_id)'
,
function
(
data
)
{
form
.
on
(
'select(user_tax_id)'
,
function
(
data
)
{
...
@@ -568,7 +598,7 @@ layui.config({
...
@@ -568,7 +598,7 @@ layui.config({
return
false
;
return
false
;
}
}
if
(
inv_type
==
3
)
{
// 专票
if
(
inv_type
==
3
)
{
//
增值税
专票
var
tax_title
=
$
(
'.tax_title'
).
text
();
var
tax_title
=
$
(
'.tax_title'
).
text
();
var
tax_no
=
$
(
'.tax_no'
).
text
();
var
tax_no
=
$
(
'.tax_no'
).
text
();
var
com_bank
=
$
(
'.com_bank'
).
text
();
var
com_bank
=
$
(
'.com_bank'
).
text
();
...
@@ -605,7 +635,7 @@ layui.config({
...
@@ -605,7 +635,7 @@ layui.config({
layer
.
msg
(
'发票信息不完善:无注册地址'
);
layer
.
msg
(
'发票信息不完善:无注册地址'
);
return
false
;
return
false
;
}
}
}
else
if
(
inv_type
==
4
)
{
}
else
if
(
inv_type
==
4
)
{
// 增值税普票
var
tax_title
=
$
(
'.tax_title_1'
).
text
();
var
tax_title
=
$
(
'.tax_title_1'
).
text
();
var
tax_no
=
$
(
'.tax_no_1'
).
text
();
var
tax_no
=
$
(
'.tax_no_1'
).
text
();
...
...
resources/views/addOrder/content.blade.php
View file @
5d6f7776
...
@@ -52,4 +52,9 @@
...
@@ -52,4 +52,9 @@
</div>
</div>
</div>
</div>
</form>
</form>
</div>
</div>
\ No newline at end of file
<script>
var
report_ids
=
"{{ $report_ids }}"
;
console
.
log
(
report_ids
)
</script>
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment