items add estimated_rebate about

This commit is contained in:
qianhy
2023-06-01 14:27:59 +08:00
parent 5929fb9694
commit b4ef47ae49
6 changed files with 92 additions and 6 deletions
+4 -2
View File
@@ -1563,7 +1563,7 @@ class Common extends CI_Controller
$count = $this->items_model->count($fhwhere);
if ($count) {
$rows = $this->items_model->select($fhwhere, "id desc", $page, $size, 'id,brand_id,s_id,v_id,cor_id,incor_id,vin');
$rows = $this->items_model->select($fhwhere, "id desc", $page, $size, 'id,brand_id,s_id,v_id,cor_id,incor_id,vin,buy_price,estimated_rebate');
//品牌车型
$brand_arr = array_unique(array_column($rows, 'brand_id'));
@@ -1580,7 +1580,9 @@ class Common extends CI_Controller
foreach ($rows as $key => $val) {
$setval = [
'id' => $val['id'],
'vin' => $val['vin']
'vin' => $val['vin'],
'buy_price' => $val['buy_price'],
'estimated_rebate' => $val['estimated_rebate'],
];
$setval['brand_name'] = isset($brands[$val['brand_id']]) ? $brands[$val['brand_id']][0]['name'] : '';
$setval['series_name'] = isset($series[$val['s_id']]) ? $series[$val['s_id']][0]['name'] : '';
+8 -3
View File
@@ -527,6 +527,7 @@ class Goods extends HD_Controller
$info['dis_price'] = $re['dis_price'] . '元';
$info['bill_price'] = $re['bill_price'] . '元';
$info['buy_price'] = $re['buy_price'] . '元';
$info['estimated_rebate'] = $re['estimated_rebate'] . '元';
$info['discount'] = $re['discount'] ? $re['discount'] . '%' : '100%';
$info['pro_time'] = $re['pro_time'] != '0000-00-00 00:00:00' ? $re['pro_time'] : '';
$info['in_time'] = $re['in_time'] != '0000-00-00 00:00:00' ? $re['in_time'] : '';
@@ -579,8 +580,8 @@ class Goods extends HD_Controller
$msg = '请选择入库时间';
} else if (!$info['company_id']) {
$msg = '请选择公司归属';
} else if (!$info['buy_price'] || $info['buy_price'] <= 0.0) {
$msg = '请输入采购成本';
//} else if (!$info['buy_price'] || $info['buy_price'] <= 0.0) {
// $msg = '请输入采购成本'; // 23.06.01 采购成本再改成 非必填
} else {
$code = SYS_CODE_SUCCESS;
}
@@ -624,6 +625,7 @@ class Goods extends HD_Controller
$addData['bill_num'] = $info['bill_num'] ? $info['bill_num'] : '';
$addData['bill_price'] = $info['bill_price'] ? $info['bill_price'] : 0.00;
$addData['buy_price'] = $info['buy_price'] ? $info['buy_price'] : 0.00;
$addData['estimated_rebate'] = $info['estimated_rebate'] ? $info['estimated_rebate'] : 0.00;
$addData['pro_time'] = $info['pro_time'] ? $info['pro_time'] : '0000-00-00 00:00:00';
$addData['in_time'] = $info['in_time'] ? $info['in_time'] : date('Y-m-d H:i:s');
@@ -795,7 +797,8 @@ class Goods extends HD_Controller
$editData['dis_price'] = $info['dis_price'];
$editData['bill_num'] = $info['bill_num'];
$editData['bill_price'] = $info['bill_price'];
$editData['buy_price'] = $info['buy_price'];
$editData['buy_price'] = $info['buy_price'] ? $info['buy_price'] : 0;
$editData['estimated_rebate'] = $info['estimated_rebate'] ? $info['estimated_rebate'] : 0;
$editData['pro_time'] = $info['pro_time'];
$editData['in_time'] = $info['in_time'];
@@ -1104,6 +1107,7 @@ class Goods extends HD_Controller
'sale_price' => '售价',
'bill_price' => '开票金额',
'buy_price' => '采购成本',
'estimated_rebate' => '预估返利',
'dis_price' => '折扣价',
'discount' => '折扣百分比',
'city_name' => '城市名',
@@ -1264,6 +1268,7 @@ class Goods extends HD_Controller
'sale_price' => $v['sale_price'],
'bill_price' => $v['bill_price'],
'buy_price' => $v['buy_price'],
'estimated_rebate' => $v['estimated_rebate'],
'dis_price' => $v['dis_price'],
'discount' => $v['discount'],
'city_name' => $addr ? $addr['city_name'] : '',
@@ -1077,6 +1077,12 @@ class Orders extends HD_Controller
if($row['bill_time']!='0000-00-00 00:00:00'){
$update['bill_time'] = $row['bill_time'];
}
$buy_price = $this->input->post('buy_price');
$buy_price_origin = $this->input->post('buy_price_origin');
$estimated_rebate = $this->input->post('estimated_rebate');
$estimated_rebate_origin = $this->input->post('estimated_rebate_origin');
$buy_price != $buy_price_origin && $update['buy_price'] = $buy_price;
$estimated_rebate != $estimated_rebate_origin && $update['estimated_rebate'] = $estimated_rebate;
$result = $this->items_model->update($update, ['id' => $item_id]);
if ($result) {
+14
View File
@@ -215,6 +215,20 @@
</div>
</td>
</tr>
<tr>
<td class="table-td">
</td>
<td class="table-td">
</td>
<td class="table-td">
</td>
<td class="table-td">
<div class="input-group">
<div class="input-group-addon">预估返利</div>
<input type="text" v-model="info.estimated_rebate" placeholder="请输入预估返利">
</div>
</td>
</tr>
<!-- <tr>-->
<!-- <td class="table-td">-->
<!-- <div class="input-group">-->
+32 -1
View File
@@ -468,7 +468,11 @@
yes: function (index) {
$.post("/receiver/orderv2/orders/edit_item", {
'id': that.info.id,
'item_id': that.info.item_id
'item_id': that.info.item_id,
'buy_price': that.info.buy_price,
'buy_price_origin': that.info.buy_price_origin,
'estimated_rebate': that.info.estimated_rebate,
'estimated_rebate_origin': that.info.estimated_rebate_origin,
}, function (data) {
if (data.code) {
layer.msg(data.msg, {time: 2000, icon: 1}, function () {
@@ -481,6 +485,22 @@
}
});
},
carModalInfo: function () {
var that = this
layer.open({
type: 1,
// area: ['40%', '50%'], //宽高
area: ['400', '300'], //宽高
content: $('#car-modal-info'),
title: '确认采购成本与预估返利',
shade: false,
btn: ['确定'],
yes: function (index) {
// alert(that.info.vin);
layer.close(index);
}
});
},
getCars: function (page) {
var vm = this;
$.ajax({
@@ -521,8 +541,19 @@
if (checked) {
vm.info.item_id = cars.id;
cars.selected = 1;
vm.info.vin = cars.vin;
vm.info.buy_price = cars.buy_price;
vm.info.buy_price_origin = cars.buy_price;
vm.info.estimated_rebate = cars.estimated_rebate;
vm.info.estimated_rebate_origin = cars.estimated_rebate;
this.carModalInfo();
} else {
vm.info.item_id = 0;
vm.info.vin = '';
vm.info.buy_price = 0;
vm.info.buy_price_origin = 0;
vm.info.estimated_rebate = 0;
vm.info.estimated_rebate_origin = 0;
}
},
beforeUsersPage: function () {
@@ -245,3 +245,31 @@
</div>
</div>
</div>
<div id="car-modal-info" style="display: none;">
<div class="modal-body">
<div class="input-group">
<div class="am-form-group fl">
<label class="am-para-label w80">车架号:</label>
<!-- <div class="am-para-inline ">-->
<label class="am-para-label fl">{{info.vin}}</label>
<!-- </div>-->
</div>
</div>
<div class="input-group">
<div class="am-form-group fl">
<label class="am-para-label w80">采购成本:</label>
<div class="am-para-inline">
<input type="text" v-model="info.buy_price" placeholder="请输入采购成本"/>
</div>
</div>
</div>
<div class="input-group">
<div class="am-form-group fl">
<label class="am-para-label w80">预估返利:</label>
<div class="am-para-inline">
<input type="text" v-model="info.estimated_rebate" placeholder="请输入预估返利"/>
</div>
</div>
</div>
</div>
</div>