修改,科汇的购物车备注
Change-Id: I92b461212f7878ff51bd6603afb2e07e9848c222
This commit is contained in:
parent
f38874762b
commit
7254bebf9a
|
@ -56,6 +56,7 @@ class Order extends REST_Controller
|
|||
$data['user'] = $this->user;
|
||||
|
||||
$total_price = $this->input->post('total_price');
|
||||
$notes = $this->input->post('notes');
|
||||
|
||||
if ($this->user->type_id != USERTYPE_OFFICIAL) {
|
||||
if (floatval($total_price) >= 0) {
|
||||
|
@ -292,7 +293,17 @@ class Order extends REST_Controller
|
|||
$preferentialPrice = 0; // 总的优惠金额
|
||||
$deduction_amount = 0; // 总的消费金额
|
||||
foreach ($dishes as $k => $d) {
|
||||
|
||||
// 科汇需要增加自定义备注
|
||||
$newReason = '';
|
||||
if(!empty($notes) && $notes[$k]){
|
||||
if($reason){
|
||||
$newReason = $reason . "({$notes[$k]})";
|
||||
}else{
|
||||
$newReason = $notes[$k];
|
||||
}
|
||||
}else{
|
||||
$newReason = $reason;
|
||||
}
|
||||
|
||||
do {
|
||||
$code = date('Ymd') . $d[0]->dc_type . substr(preg_replace("/[a-z]/", "", md5(rand()."_1".microtime())."0000"), 0, 6);
|
||||
|
@ -362,7 +373,7 @@ class Order extends REST_Controller
|
|||
|
||||
$qrcode_url = "/show/get.php?act=getQRCode&takecode=" . $take_food_code;
|
||||
$order = array('code' => $code, "parent_code" => $parent_code, "state_id" => ORDER_STATE_ORDERED, "uid" => -$this->user->id,
|
||||
"date_id" => $k, "type" => $type, "create_time" => date('Y-m-d H:i:s'), "book_num" => $num, "take_num" => 0, "reason" => $reason,
|
||||
"date_id" => $k, "type" => $type, "create_time" => date('Y-m-d H:i:s'), "book_num" => $num, "take_num" => 0, "reason" => $newReason,
|
||||
"take_food_code" => $take_food_code, 'total_num' => $total['total_num'], 'total_price' => $total['total_price'],
|
||||
"qrcode_url" => $qrcode_url, "qrcode_path" => '', "book_fee" => $this->common->get_fee($type, $d[0], ACTION_BOOK));
|
||||
// print_r($order);
|
||||
|
@ -508,6 +519,7 @@ class Order extends REST_Controller
|
|||
$data['user'] = $this->user;
|
||||
|
||||
$total_price = $this->input->post('total_price');
|
||||
$notes = $this->input->post('notes');
|
||||
|
||||
if ($this->user->type_id != USERTYPE_OFFICIAL) {
|
||||
if (floatval($total_price) >= 0) {
|
||||
|
@ -619,6 +631,18 @@ class Order extends REST_Controller
|
|||
$oidList = array();
|
||||
$smsList = array();
|
||||
foreach ($dishes as $k => $d) {
|
||||
// 科汇需要增加自定义备注
|
||||
$newReason = '';
|
||||
if(!empty($notes) && $notes[$k]){
|
||||
if($reason){
|
||||
$newReason = $reason . "({$notes[$k]})";
|
||||
}else{
|
||||
$newReason = $notes[$k];
|
||||
}
|
||||
}else{
|
||||
$newReason = $reason;
|
||||
}
|
||||
|
||||
do {
|
||||
$code = date('Ymd') . $d[0]->dc_type . substr(preg_replace("/[a-z]/", "", md5(rand()."_1".microtime())."0000"), 0, 6);
|
||||
$t_order = $this->Order_model->get_order_by_code($code);
|
||||
|
@ -660,7 +684,7 @@ class Order extends REST_Controller
|
|||
|
||||
$qrcode_url = "/show/get.php?act=getQRCode&takecode=" . $take_food_code;
|
||||
$order = array('code' => $code, "parent_code" => $parent_code, "state_id" => ORDER_STATE_ORDERED, "uid" => -$this->user->id,
|
||||
"date_id" => $k, "type" => $type, "create_time" => date('Y-m-d H:i:s'), "book_num" => $num, "take_num" => 0, "reason" => $reason,
|
||||
"date_id" => $k, "type" => $type, "create_time" => date('Y-m-d H:i:s'), "book_num" => $num, "take_num" => 0, "reason" => $newReason,
|
||||
"take_food_code" => $take_food_code, 'total_num' => $total['total_num'], 'total_price' => $total['total_price'],
|
||||
"qrcode_url" => $qrcode_url, "qrcode_path" => '', "book_fee" => $this->common->get_fee($type, $d[0], ACTION_BOOK));
|
||||
// print_r($order);
|
||||
|
|
28
m/js/main.js
28
m/js/main.js
|
@ -8756,9 +8756,9 @@ $(function () {
|
|||
if(meal.notes){
|
||||
var notes = JSON.parse(meal.notes);
|
||||
cartHtml +=
|
||||
'<li><div class="row no-gutter"><div class="col-100"><p class="ma-0 tips text-red">备注:' +
|
||||
'<li><div class="row no-gutter"><div class="col-100"><p class="ma-0 tips text-red">备注:<input type="text" style="width:75%;display:inline-block;font-size:0.65rem" class="notes['+ meal.date_id +']" placeholder="' +
|
||||
notes.text +
|
||||
'</p></div></div></li>';
|
||||
'"></p></div></div></li>';
|
||||
}
|
||||
cartHtml += '</ul>';
|
||||
});
|
||||
|
@ -9010,6 +9010,17 @@ $(function () {
|
|||
});
|
||||
$(page).on('click', '.xhl', function () {
|
||||
if (!$(this).hasClass('btnDisabled')) {
|
||||
var notesObj = {};
|
||||
$("input[class*='notes']").each(function() {
|
||||
// 获取类名并尝试匹配正则表达式以提取 date_id
|
||||
var className = $(this).attr("class");
|
||||
var match = className.match(/notes\[(\d+)\]/); // 调整正则以匹配你的格式
|
||||
if (match) {
|
||||
var dateId = match[1];
|
||||
var text = $(this).val(); // 获取placeholder文本
|
||||
notesObj[dateId] = $.trim(text); // 创建对象,使用 date_id 作为键,placeholder文本作为值
|
||||
}
|
||||
});
|
||||
$.showIndicator();
|
||||
var token = user.token;
|
||||
$.ajax({
|
||||
|
@ -9019,6 +9030,7 @@ $(function () {
|
|||
data: {
|
||||
total_price: totalPrice,
|
||||
token: token,
|
||||
notes: notesObj
|
||||
},
|
||||
success: function (ret) {
|
||||
$.hideIndicator();
|
||||
|
@ -9123,6 +9135,17 @@ $(function () {
|
|||
|
||||
$(page).on('click', '.order_yzf', function () {
|
||||
if (!$(this).hasClass('btnDisabled')) {
|
||||
var notesObj = {};
|
||||
$("input[class*='notes']").each(function() {
|
||||
// 获取类名并尝试匹配正则表达式以提取 date_id
|
||||
var className = $(this).attr("class");
|
||||
var match = className.match(/notes\[(\d+)\]/); // 调整正则以匹配你的格式
|
||||
if (match) {
|
||||
var dateId = match[1];
|
||||
var text = $(this).val(); // 获取placeholder文本
|
||||
notesObj[dateId] = $.trim(text); // 创建对象,使用 date_id 作为键,placeholder文本作为值
|
||||
}
|
||||
});
|
||||
$.showIndicator();
|
||||
var token = user.token;
|
||||
$.ajax({
|
||||
|
@ -9132,6 +9155,7 @@ $(function () {
|
|||
data: {
|
||||
total_price: totalPrice,
|
||||
token: token,
|
||||
notes: notesObj
|
||||
},
|
||||
success: function (ret) {
|
||||
$.hideIndicator();
|
||||
|
|
Loading…
Reference in New Issue