Commit 0494341d by 朱继来

调整交期

parents 49326f8d e978e746
......@@ -140,7 +140,7 @@ class InquiryModel extends Model
}
#交货日期
$v['delivery_time'] = $v['delivery_time'] > 6 ? $v['delivery_time'].'周' : $v['delivery_time']."天";
$v['delivery_time'] = $v['delivery_time'] > 6 ? ($v['delivery_time']/7).'周' : $v['delivery_time']."天";
#查询所有报价
$v['quote_price'] = "--";
......
......@@ -175,14 +175,14 @@ class QuoteModel extends Model
} else {
$list = $list->paginate($limit, ['*'], 'page', $page)->toArray();
$list['data'] = $this->handleData($list['data']);
$list['data'] = $this->handleData($list['data'], $type);
return [0, '获取成功', $list['data'], $list['total']];
}
}
// 处理数据
public function handleData($data)
public function handleData($data, $type)
{
if (empty($data)) return $data;
......@@ -192,6 +192,14 @@ class QuoteModel extends Model
$v['currency_val'] = $v['currency'] == 1 ? 'RMB' : 'USD';
$v['price'] = $v['currency'] == 1 ? $currency_sign.$v['price_rmb'] : $currency_sign.$v['price_origin'];
$v['status_val'] = array_get(Config('quote.quote_status'), $v['status'], '');
if ($type == 3) { // 报价草稿
if ($v['delivery_time'] > 6) {
$v['delivery_time'] = intval($v['delivery_time'] / 7).'周';
} else {
$v['delivery_time'] = $v['delivery_time'].'天';
}
}
}
return $data;
......@@ -330,7 +338,7 @@ class QuoteModel extends Model
$InquiryModel = new InquiryModel;
$inquiry_uid = $InquiryModel->where('id', $inquiry_id)->value('create_uid'); // 询价人
$contents = '系统自动报价,请及时查看!';
$contents = '您有新报价,请及时查看!';
$CommonModel->send_msg($inquiry_uid, $contents);
return [0,"新增成功"];
......@@ -476,6 +484,13 @@ class QuoteModel extends Model
$v['price_rmb'] = $rate ? number_format($v['price_origin'] * $rate, 6) : 0;
}
if (strpos($v['delivery_time'], "周") !== false) {
$delivery_time_week = intval(str_replace("周", "", $v['delivery_time']));
$v['delivery_time'] = $delivery_time_week * 7;
} else {
$v['delivery_time'] = intval(str_replace("天", "", $v['delivery_time']));
}
$v['quote_sn'] = $ApiController->createSn($this, 'quote_sn', 'B');
$v['inquiry_id'] = $input['inquiry_id'];
$v['inquiry_sn'] = $input['inquiry_sn'];
......@@ -568,6 +583,23 @@ class QuoteModel extends Model
return;
}
if (strpos($val['delivery_time'], "天") === false && strpos($val['delivery_time'], "周") === false) {
$err[] = '第'.($key+1).'行,交期输入有误,请以天或周结尾';
return;
}
$delivery_time_day = intval(str_replace("天", "", $val['delivery_time']));
if ($delivery_time_day > 6) {
$err[] = '第'.($key+1).'行,交期输入有误,单位为天时,不能大于6,请按周计数';
return;
}
$delivery_time_week = intval(str_replace("周", "", $val['delivery_time']));
if ($delivery_time_week > 108) {
$err[] = '第'.($key+1).'行,交期输入有误,单位为周时,不能大于108周';
return;
}
foreach ($val as $k=>$v) {
if (in_array($k, $required_keys)) {
if (empty($v)) { // 若必填项值为空,返回提示信息
......
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