add-licheb-options

This commit is contained in:
lccsw
2023-03-21 16:02:33 +08:00
parent f44f84aaa2
commit 2804ba500b
12 changed files with 634 additions and 4 deletions
+8 -1
View File
@@ -16,6 +16,7 @@ class Attr extends HD_Controller
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
$this->load->model('auto/auto_attr_model');
$this->load->model('auto/auto_option_model');
}
public function index()
@@ -105,7 +106,8 @@ class Attr extends HD_Controller
$id = $this->input->get('id');
$info = [
'title' => ''
'title' => '',
'options' => [],
];
if ($id) {
$info = $this->auto_attr_model->get(array('id' => $id));
@@ -114,17 +116,20 @@ class Attr extends HD_Controller
}
$info['jsondata'] = json_decode($info['jsondata'], true);
$info['jsondata']['img'] && $info['jsondata']['s_img'] = build_qiniu_image_url($info['jsondata']['img']);
$info['options'] = $info['jsondata']['options'] ? $info['jsondata']['options'] : [];
}
$brand_id = '';
if ($info['s_id']) {
$row_sery = $this->auto_series_model->get(array('id' => $info['s_id']));
$brand_id = $row_sery['brand_id'];
}
$options = $this->auto_option_model->select(['status'=>1],'id desc',0,0,'id,title,price');
$type_arr = $this->auto_attr_model->get_type();
!$info['type'] && $info['type'] = 0;
$info['brand_id'] = $brand_id;
!$info['s_id'] && $info['s_id'] = '';
!$info['jsondata']['img'] && $info['jsondata']['img'] = '';
$this->data['options'] = $options;
$this->data['type_arr'] = $type_arr;
$this->data['info'] = $info;
$this->data['_title'] = $id ? '编辑' : '新增';
@@ -146,6 +151,7 @@ class Attr extends HD_Controller
'type' => $post['type'],
'c_time' => time()
];
$post['jsondata']['options'] = $post['options'] ? $post['options'] : [];
$post['jsondata'] && $add_data['jsondata'] = json_encode($post['jsondata'], JSON_UNESCAPED_UNICODE);
$result = $this->auto_attr_model->add($add_data);
if (!$result) {
@@ -172,6 +178,7 @@ class Attr extends HD_Controller
's_id' => $post['s_id'],
'type' => $post['type'],
];
$post['jsondata']['options'] = $post['options'] ? $post['options'] : [];
$post['jsondata'] && $update['jsondata'] = json_encode($post['jsondata'], JSON_UNESCAPED_UNICODE);
$result = $this->auto_attr_model->update($update, ['id' => $row['id']]);
if (!$result) {
+192
View File
@@ -0,0 +1,192 @@
<?php
/**
* Created by Vim
* User: lcc
* Date: 2023/03/14
* Time: 10:19
*/
defined('BASEPATH') OR exit('No direct script access allowed');
class Options extends HD_Controller
{
public function __construct()
{
parent::__construct();
$this->load->model('auto/auto_option_model');
$this->load->model('auto/auto_brand_model');
$this->load->model('auto/auto_series_model');
}
public function index()
{
$this->lists();
}
public function lists()
{
$params = $this->input->get();
!$params['s_id'] && $params['s_id'] = '';
!$params['brand_id'] && $params['brand_id'] = '';
$page = $this->input->get('page');
!$page && $page = 1;
$size = 20;
$where["status > -1"] = null;
$params['title'] && $where["title like '%{$params['title']}%'"] = null;
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map_brand($where_brand);
$params['brand_id'] && $where['brand_id'] = intval($params['brand_id']);
$params['s_id'] && $where['s_id'] = intval($params['s_id']);
$count = $this->auto_option_model->count($where);
$list = [];
if($count){
$status_arr = $this->auto_option_model->get_status();
$rows = $this->auto_option_model->select($where,'id desc',$page,$size);
$b_rows = $this->auto_brand_model->get_map_by_ids(array_column($rows,'brand_id'));
$s_rows = $this->auto_series_model->get_map_by_ids(array_column($rows,'s_id'));
foreach ($rows as $item) {
$b_row = $b_rows[$item['brand_id']][0];
$s_row = $s_rows[$item['s_id']][0];
$list[] = [
'id' => $item['id'],
'brand_cn' => $b_row['name'],
'series_cn' => $s_row['name'],
'title' => $item['title'],
'price' => $item['price'],
'status_name' => $status_arr[$item['status']],
'status' => $item['status'],
'c_time' => date('Y-m-d H:i:s',$item['c_time'])
];
}
}
$this->data['lists'] = $list;
$this->data['params'] = $params;
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['pager'] = array('count' => ceil($count / $size), 'curr' => $page, 'totle' => $count);
$this->data['_title'] = '选装管理';
$this->show_view('auto/options/lists', true);
}
public function get()
{
$id = $this->input->get('id');
$info = [
'title' => '',
'options' => [],
'brand_id' => 0,
's_id' => 0
];
if ($id) {
$info = $this->auto_option_model->get(array('id' => $id));
if (!$info) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在!');
}
$info['brand_id'] = " {$info['brand_id']}";
}
//获取品牌map
$where_brand = array('status > -1' => null);
$map_brand = $this->auto_brand_model->map_brand($where_brand);
$this->data['brandAry'] = $this->auto_brand_model->map_brand_list($map_brand);
$this->data['info'] = $info;
$this->data['_title'] = $id ? '编辑' : '新增';
return $this->show_view('auto/options/edit',true);
}
public function add()
{
if (!$this->if_ajax) {
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
}
$post = $this->input->post();
if (!$post['title']) {
return $this->show_json(SYS_CODE_FAIL, '标题不能为空');
}
$add_data = [
'title' => $post['title'],
'price' => floatval($post['price']),
'brand_id' => intval($post['brand_id']),
's_id' => intval($post['s_id']),
'descrip' => $post['descrip'],
'c_time' => time()
];
$result = $this->auto_option_model->add($add_data);
if (!$result) {
return $this->show_json(SYS_CODE_FAIL, '添加失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '添加成功');
}
public function edit()
{
if (!$this->if_ajax) {
return $this->show_json(SYS_CODE_FAIL, '提交出错!');
}
$post = $this->input->post();
$row = $this->auto_option_model->get(['id' => $post['id']]);
if (!$row) {
return $this->show_json(SYS_CODE_FAIL, '数据不存在');
}
if (!$post['title']) {
return $this->show_json(SYS_CODE_FAIL, '标题不能为空');
}
$update = [
'title' => $post['title'],
'price' => floatval($post['price']),
'descrip' => $post['descrip'],
'brand_id' => intval($post['brand_id']),
's_id' => intval($post['s_id']),
];
$result = $this->auto_option_model->update($update, ['id' => $row['id']]);
if (!$result) {
return $this->show_json(SYS_CODE_FAIL, '保存失败');
}
return $this->show_json(SYS_CODE_SUCCESS, '保存成功');
}
public function del()
{
$id = $this->input->post('id');
if (!$id) {
$this->show_json(SYS_CODE_FAIL, '参数错误');
}
$stauts = $this->input->post('status');
$where = ['id' => $id];
$this->auto_option_model->update(['status' => $stauts], $where);
return $this->show_json(SYS_CODE_SUCCESS, '操作成功');
}
public function batch()
{
}
public function export()
{
}
function json_lists()
{
$brand_id = $this->input->get('brand_id');
$s_id = $this->input->get('s_id');
$where = [
'status'=>1,
'brand_id' => intval($brand_id)
];
$s_id && $where['s_id'] = $s_id;
$lists = [];
$rows = $this->auto_option_model->select($where,'','','','id,title,price');
if($rows){
foreach ($rows as $items) {
$lists[] = $items;
}
}
$this->data['lists'] = $lists;
$this->show_json(SYS_CODE_SUCCESS,'');
}
}
+4
View File
@@ -432,6 +432,7 @@ class Goods extends HD_Controller
$info['company_id'] = $info['brand_id'] = $info['s_id'] = $info['v_id'] = $info['cor_id'] = $info['incor_id'] = 0;
$info['if_pack'] = $info['city_id'] = $info['county_id'] = $info['biz_id'] = $info['addr_id'] = '';
$info['status'] = 1;
$info['option_ids'] = [];
$autoList[2] = $autoList[3] = $autoList[4] = $autoList[5] = array();
$comList = $this->sys_company_model->select(['status' => 1], '', '', '', 'id,short');
if ($id > 0) {
@@ -440,6 +441,7 @@ class Goods extends HD_Controller
return $this->show_json(SYS_CODE_FAIL, '商品不存在!');
}
$info = $re;
$info['option_ids'] = $info['option_ids'] ? json_decode($info['option_ids'],true) : [];
$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'] : '';
$info['out_time'] = $re['out_time'] != '0000-00-00 00:00:00' ? $re['out_time'] : '';
@@ -634,6 +636,7 @@ class Goods extends HD_Controller
}
$addData['biz_id'] = $biz_id;
$addData['addr_id'] = $addr_id;
$addData['option_ids'] = $info['option_ids'] ? json_encode($info['option_ids']) : json_encode([]);
$id = $this->mdItems->add($addData);
if (!$id) {
return $this->show_json(SYS_CODE_FAIL, '添加失败!');
@@ -806,6 +809,7 @@ class Goods extends HD_Controller
}
$editData['biz_id'] = $biz_id;
$editData['addr_id'] = $addr_id;
$editData['option_ids'] = $info['option_ids'] ? json_encode($info['option_ids']) : json_encode([]);
$ret = $this->mdItems->update($editData, array('id' => $info['id']));
if (!$ret) {
return $this->show_json(SYS_CODE_FAIL, '修改失败!');
+23 -1
View File
@@ -59,6 +59,16 @@
</div>
</div>
</template>
<!--选装-->
<div class="am-form-group" v-if="info.type==1">
<label class="am-para-label">选装包:</label>
<div class="am-para-input">
<label class="mr10" style="margin-top: 7px" v-for="(v,i) in options">
<input type="checkbox" name="options[]" :value="v.id" v-model="info.options">&nbsp;{{v.title}}(价格:{{v.price}})
</label>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit()">保存</button>
@@ -73,7 +83,8 @@
info:[],
brandAry:[],
seryAry:[],
type_arr:[]
type_arr:[],
options:[]
},
mounted: function () {
this.info = <?=json_encode($info)?>;
@@ -150,6 +161,17 @@
layer.closeAll('loading');
}
});
$.get("/auto/options/json_lists",{'brand_id':nv,'s_id':vm.info.s_id},function (res){
vm.options = res.data.lists
},'json');
}
},
'info.s_id':function(nv, ov){
var vm = this;
if(nv > 0){
$.get("/auto/options/json_lists",{'brand_id':vm.info.brand_id,'s_id':nv},function (res){
vm.options = res.data.lists
},'json');
}
}
}
+113
View File
@@ -0,0 +1,113 @@
<form id="vue-app-edit" class="am-form am-form-horizontal" action="" data-auto="true" method="post" style="width: 90%;padding-top: 10px">
<div class="am-form-group">
<label class="am-para-label">标题:</label>
<div class="am-para-input">
<input type="text" placeholder="输入标题" name="title" v-model="info.title">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">品牌车系:</label>
<div class="am-para-input">
<select name="brand_id" v-model="info.brand_id" style="display: inline; width: 120px;">
<option value="0">请选择</option>
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
</select>
<select name="s_id" v-model="info.s_id" style="display: inline; width: 120px;">
<option value="0">请选择</option>
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">价格:</label>
<div class="am-para-input w150">
<input type="text" placeholder="输入价格" name="number" v-model="info.price">
</div>
</div>
<div class="am-form-group">
<label class="am-para-label">描述:</label>
<div class="am-para-input">
<textarea name="content" id="editor" v-model="info.descrip"></textarea>
</div>
</div>
<div class="am-form-group" style="margin-bottom: 2rem">
<div class="am-para-input">
<button class="am-btn am-btn-secondary" type="button" @click="saveEdit()">保存</button>
</div>
</div>
</form>
<script>
$(document).ready(function () {
require(['ckeditor'], function (ckeditor) {
window.createEditor('[name="content"]');
});
vue_obj = new Vue({
el: '#vue-app-edit',
data: {
brandAry: [],
info:[],
seryAry: [],
},
mounted: function () {
this.info = <?=json_encode($info,JSON_UNESCAPED_UNICODE)?>;
this.brandAry = <?=json_encode($brandAry,JSON_UNESCAPED_UNICODE)?>;
},
methods: {
saveEdit: function(){
var action = '';
this.info.descrip = CKEDITOR.instances.editor.getData();
if(this.info.id){
action = 'auto/options/edit'
}else{
action = 'auto/options/add'
}
$.post(action,this.info,function(result){
if (result.code) {
layer.msg(result.msg, {time: 2000, icon: 1}, function () {
$.form.reload();
});
} else {
layer.msg(result.msg, {icon: 2});
}
},'json')
}
},
watch: {
'info.brand_id': function (nv, ov) {
var vm = this;
vm.seryAry = {};
if (nv > 0) {
$.ajax({
url: '/auto/series/json_lists',
type: 'post',
dataType: 'json',
data: {brand_id: nv},
beforeSend: function () {
},
success: function (data) {
if (1 == data.code) {
var lists = data.data.list;
var seryAry = {};
for (var i in lists) {
var row = lists[i];
seryAry[row.id] = row.name;
}
vm.seryAry = seryAry;
if (vm.info.s_id > 0 && undefined == seryAry[vm.info.s_id]) {
vm.info.s_id = '';
}
}
},
complete: function () {
loading = 0;
layer.closeAll('loading');
}
});
} else {
vm.params.s_id = '';
}
}
}
})
});
</script>
+158
View File
@@ -0,0 +1,158 @@
<div class="coms-table-wrap mt10">
<form class="form-search" onsubmit="return false" action="/auto/options/lists">
<div class="am-form am-form-horizontal">
<div class="am-form-group fl">
<label class="am-para-label w100">标题:</label>
<div class="am-para-inline w200">
<input type="text" name="title" value="<?= $params['title'] ?>"/>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label w100">品牌:</label>
<div class="am-para-inline w150">
<select name="brand_id" v-model="params.brand_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in brandAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl">
<label class="am-para-label">车系:</label>
<div class="am-para-inline w150">
<select name="s_id" v-model="params.s_id">
<option value="">请选择</option>
<option :value="i" v-for="(v,i) in seryAry">{{v}}</option>
</select>
</div>
</div>
<div class="am-form-group fl ml10">
<label class="am-para-label w50"></label>
<button type="submit" class="am-btn am-btn-success w100">搜索</button>
</div>
<div class="am-form-group fl ml10">
<button type="button" data-title="新增g " data-open="/auto/options/get" class="am-btn am-btn-success w100">
新增
</button>
</div>
<div class="am-form-group fr" style="font-size: 15px;padding-right: 20px;padding-top: 6px;">
共有<?= $pager['totle'] ?>条数据
</div>
</div>
</form>
<div class="coms-table-bd">
<table class="am-table am-table-bordered">
<thead>
<tr>
<th width="10%"><span>ID</span></th>
<th width="20%"><span>品牌</span></th>
<th width="20%"><span>车系</span></th>
<th width="20%"><span>标题</span></th>
<th width="10%"><span>价格</span></th>
<th width="10%"><span>状态</span></th>
<th width="15%"><span>创建时间</span></th>
<th width="15%"><span>操作</span></th>
</tr>
</thead>
<tbody>
<?php foreach ($lists as $v) { ?>
<tr>
<td><?= $v['id'] ?></td>
<td><?= $v['brand_cn'] ?></td>
<td><?= $v['series_cn'] ?></td>
<td><?= $v['title'] ?></td>
<td><?= $v['price'] ?></td>
<td><?= $v['status_name'] ?></td>
<td><?= $v['c_time'] ?></td>
<td>
<?php if ($v['status'] > -1) { ?>
<a href="javascript:void (0);" data-title="编辑车系" data-open="/auto/options/get?id=<?= $v['id'] ?>"
class="am-text-primary"><?= '编辑' ?></a>
<?php } ?>
<?php if ($v['status'] == 1) { ?>
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/options/del"
data-params-id="<?= $v['id'] ?>" data-params-status="0">禁用</a>
<?php }
elseif ($v['status'] == 0) { ?>
| <a style="color: red" href="javascript:void (0);" data-ajax="post" data-action="/auto/options/del"
data-params-id="<?= $v['id'] ?>" data-params-status="1">恢复</a>
<?php } ?>
<?php if ($v['status'] > -1) { ?>
| <a href="javascript:void (0);" data-ajax="post" data-action="/auto/attr/del"
data-params-id="<?= $v['id'] ?>" data-params-status="-1">删除</a>
<?php } ?>
</td>
</tr>
<?php } ?>
</tbody>
</table>
</div>
<div class="coms-table-ft clearfix">
<div class="coms-pagination fr mr20">
<?php page_view($pager) ?>
</div>
</div>
</div>
<script>
var vue_obj;
var loading = 0;
$(function () {
vue_obj = new Vue({
el: '.coms-table-wrap',
data: {
params: [],
brandAry: [],
seryAry: [],
type_arr: [],
status_arr: [],
},
mounted: function () {
var vm = this;
vm.params = <?=json_encode($params)?>;
vm.brandAry = <?=json_encode($brandAry)?>;
vm.type_arr = <?=json_encode($type_arr)?>;
vm.status_arr = <?=json_encode($status_arr)?>;
},
methods: {},
watch: {
'params.brand_id': function (nv, ov) {
var vm = this;
vm.seryAry = {};
if (nv > 0) {
$.ajax({
url: '/auto/series/json_lists',
type: 'post',
dataType: 'json',
data: {brand_id: nv},
beforeSend: function () {
},
success: function (data) {
if (1 == data.code) {
var lists = data.data.list;
var seryAry = {};
for (var i in lists) {
var row = lists[i];
seryAry[row.id] = row.name;
}
vm.seryAry = seryAry;
if (vm.params.s_id > 0 && undefined == seryAry[vm.params.s_id]) {
vm.params.s_id = '';
}
}
},
complete: function () {
loading = 0;
layer.closeAll('loading');
}
});
} else {
vm.params.s_id = '';
}
}
}
});
<?php page_script($pager) ?>
});
</script>
+29 -1
View File
@@ -96,6 +96,17 @@
</div>
</td>
</tr>
<tr>
<td class="table-td" colspan="2">
<div class="input-group">
<div class="input-group-addon">选装包</div>
<label class="mr10" style="margin-top: 7px" v-for="(v,i) in options">
<input type="checkbox" name="option_ids[]" :value="v.id" v-model="info.option_ids">&nbsp;{{v.title}}(价格:{{v.price}})
</label>
<input type="hidden" name="" >&nbsp;
</div>
</td>
</tr>
<tr>
<td class="table-td">
<div class="input-group">
@@ -321,7 +332,8 @@
addrAry: [],
bizAry: [],
fines: [],
modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0}
modal_fine: {title: '', lists: [], selected: [], page: 1, size: 10, total: 0},
options:[]
},
mounted: function () {
var that = this;
@@ -700,6 +712,22 @@
});
}
},
'info.brand_id': function (nv, ov) {
var vm = this;
if(nv > 0){
$.get("/auto/options/json_lists",{'brand_id':nv,'s_id':vm.info.s_id},function (res){
vm.options = res.data.lists
},'json');
}
},
'info.s_id': function (nv, ov) {
var vm = this;
if(nv > 0){
$.get("/auto/options/json_lists",{'brand_id':vm.info.brand_id,'s_id':nv},function (res){
vm.options = res.data.lists
},'json');
}
},
}
});
});
+54
View File
@@ -0,0 +1,54 @@
<?php
defined('WXAPP_APP') OR exit('No direct script access allowed');
/**
* User: lcc
* Date: 2023.03.21
* Time: 14:08
*/
require_once APPPATH.'controllers/wxapp/Wxapp.php';
class Options extends Wxapp{
function __construct($inputs, $app_key){
parent::__construct($inputs, $app_key);
$this->login_white = array('get');//登录白名单
$this->check_status = array();//用户状态校验
$this->check_mobile = array();//需要手机号
$this->check_headimg =array();//授权微信信息
$this->load->model('auto/auto_option_model');
}
protected function get(){
$page = $this->input_param('page');
$size = $this->input_param('size');
$s_id = $this->input_param('id'); //车系id
!$page && $page = 1;
!$size && $size = 100;
$where = [
'status' => 1,
's_id' => $s_id
];
$count = $this->auto_option_model->count($where);
$lists = [];
if($count){
$rows = $this->auto_option_model->select($where,'id desc',$page,$size);
foreach ($rows as $item) {
$lists[] = [
'id' => $item['id'],
'title' => $item['title'],
'descrip' => $item['descrip'],
'price' => $item['price']
];
}
}
$data = [
'list' => $lists,
'total' => $count
];
return $data;
}
}
@@ -36,6 +36,7 @@ class CusorderV2 extends Wxapp
$this->load->model('auto/auto_attr_model');
$this->load->model('auto/auto_cars_model');
$this->load->model('auto/auto_business_model');
$this->load->model('auto/auto_option_model');
$this->load->model("biz/biz_model");
$this->load->model('items/items_model');
@@ -98,6 +99,7 @@ class CusorderV2 extends Wxapp
$if_local_bill = $this->input_param('if_local_bill');//是否需要开具本地发票
$if_zero_firstpay = $this->input_param('if_zero_firstpay');//$payway=0下是否0首付;0首付区分:payway==0 && money_json.price_book==0
//$if_zero_firstpay = 1; $deposit = 0; // 模拟0首付
$optinos_ids = $this->input_param('options_ids');//选装id 数组
$row = $this->customers_model->get(['id' => $cus_id]);
$series_row = $this->auto_series_model->get(['id' => $car_id]);
@@ -222,6 +224,7 @@ class CusorderV2 extends Wxapp
'price_fine_select' => 0,
'price_color' => $price_color,
'price_coplus' => $price_coplus,
'price_options' => 0
];
if ($srv_arr) {
foreach ($srv_arr as $item) {
@@ -238,6 +241,13 @@ class CusorderV2 extends Wxapp
}
}
}
//选装金额
if($optinos_ids){
$data['option_ids'] = json_encode($optinos_ids);
$optinos_ids_str = implode(',',$optinos_ids);
$optinos_ids_str && $optinos_rows = $this->auto_option_model->select(["id in ({$optinos_ids_str})"=>null],'','','','id,price');
$optinos_rows && $money_json['price_options'] = array_sum(array_column($optinos_rows,'price'));
}
$car_json = $money_json;
$car_json['delivery_day'] = $business_row['delivery_day'];
$data['money_json'] = json_encode($money_json, JSON_UNESCAPED_UNICODE);
@@ -371,6 +381,7 @@ class CusorderV2 extends Wxapp
$sa = $this->input_param('sa'); //补充协商
$if_local_bill = $this->input_param('if_local_bill');//是否需要开具本地发票
$if_zero_firstpay = $this->input_param('if_zero_firstpay');//$payway=0下是否0首付;0首付区分:payway==0 && money_json.price_book==0
$optinos_ids = $this->input_param('options_ids');//选装id 数组
$row = $this->orders_model->get(['id' => $id]);
$main_type = $row['main_type'];
@@ -496,6 +507,14 @@ class CusorderV2 extends Wxapp
}
}
}
$data['option_ids'] = json_encode($optinos_ids);
$money_json['price_options'] = 0;
//选装金额
if($optinos_ids){
$optinos_ids_str = implode(',',$optinos_ids);
$optinos_ids_str && $optinos_rows = $this->auto_option_model->select(["id in ({$optinos_ids_str})"=>null],'','','','id,price');
$optinos_rows && $money_json['price_options'] = array_sum(array_column($optinos_rows,'price'));
}
if ($row['c_time'] >= strtotime('2022-04-08 14:43:00')) {
$this->ck_money($money_json, $srv_arr, $biz);
}
@@ -565,6 +584,14 @@ class CusorderV2 extends Wxapp
$car_data['委托代办']['list'][$val['title']] = is_numeric($val['money']) ? sprintf("%.2f", $val['money']) : '';
}
}
$optinos_ids_str = $row['option_ids'] ? implode(',',json_decode($row['option_ids'],true)) : '';
if($optinos_ids_str){
$optinos_rows = $this->auto_option_model->select(["id in ({$optinos_ids_str})"=>null],'','','','id,title,price');
$car_data['选装']['value'] = sprintf("%.2f", $money_json['price_options']);
foreach ($optinos_rows as $item) {
$car_data['选装']['list'][$item['title']] = is_numeric($item['price']) ? sprintf("%.2f", $item['price']) : '';
}
}
$fines = json_decode($row['fines'], true);
if ($fines) {
$fines_list = [];
@@ -691,6 +718,7 @@ class CusorderV2 extends Wxapp
$order_data = $this->receiver_order_datas_model->get(['o_id' => $row['id']], 'sa');
$data['sa'] = $order_data['sa'] ? $order_data['sa'] : '';
$data['refund_status'] = $row['status'] == 2 ? true : false;
$data['option_ids'] = $row['option_ids'] ? json_decode($row['option_ids'],true) : [];
return $data;
}
@@ -477,6 +477,9 @@ class Orders_v2_entity{
if($money_json['price_coplus']){
$total_price += $money_json['price_coplus'];
}
if($money_json['price_options']){
$total_price += $money_json['price_options'];
}
return $total_price ? $total_price : 0;
}
+21
View File
@@ -0,0 +1,21 @@
<?php
defined('BASEPATH') OR exit('No direct script access allowed');
/**
* Created by Vim.
* User: lcc
* Date: 2023/03/14
* Time: 16:24
*/
class Auto_option_model extends HD_Model{
private $table_name = 'lc_auto_option';
private $status_arr = [ '-1' => '删除',0 => '下架',1 => '正常'];
public function __construct()
{
parent::__construct($this->table_name, 'default');
}
public function get_status(){
return $this->status_arr;
}
}
+1 -1
View File
@@ -161,7 +161,7 @@ create table lc_receiver_order_signs (
-- Table:lc_receiver_orders
--- jsondata if_fine 是否选择精品尊享包
-- info_json entrust_name 代办人姓名 entrust_idcard 代办人身份证 name 姓名 sex 性别 nation 民族 birth 出生日期 address 家庭地址 cardid 身份证 c_address 创建时输入的地址 c_cardid 创建时输入的身份证
-- money_json price_car 裸车价 price_book 定金 price_insure 保险价格 price_fine 精品报价 price_finance 金融报价 price_loan贷款金额 price_discount优惠金额 price_intention意向金 price_fine_discount精品优惠金额 price_fine_select精品选装总金额
-- money_json price_car 裸车价 price_book 定金 price_insure 保险价格 price_fine 精品报价 price_finance 金融报价 price_loan贷款金额 price_discount优惠金额 price_intention意向金 price_fine_discount精品优惠金额 price_fine_select精品选装总金额 price_options选装金额
-- ---------------------------
drop table if exists lc_receiver_orders;
create table lc_receiver_orders (