wanghousheng 8 months ago
parent 978d43f316
commit aa1c20d448
  1. 32
      app/api/controller/Order.php
  2. 22
      app/api/controller/StoreKeeper.php

@ -41,37 +41,7 @@ class Order extends Controller
public function list(string $dataType): Json public function list(string $dataType): Json
{ {
$model = new OrderModel; $model = new OrderModel;
$result = $model->getList($dataType); $list = $model->getList($dataType);
$data = $result->items();
if (!empty($data)) {
foreach ($data as $key => $value) {
$copy_text = "订单号:{$value['order_no']}\n";
foreach ($value['goods'] as $good) {
$copy_text .= "商品名称:{$good['goods_name']}\n";
if (!empty($good['goods_no'])) {
$copy_text .= "商品编号:{$good['goods_name']}\n";
}
$copy_text .= "商品单价:{$good['goods_price']}\n";
$copy_text .= "商品数量:{$good['total_num']}\n";
$copy_text .= "商品总价:{$good['total_price']}\n";
$copy_text .= "\n";
}
if (!empty($value['address'])) {
$copy_text .= "收件人:{$value['address']['name']}\n";
$copy_text .= "收件电话:{$value['address']['phone']}\n";
$address = '';
if (!empty($value['address']['region'])) {
$address = $value['address']['region']['province'] . $value['address']['region']['city'] . $value['address']['region']['region'];
}
$copy_text .= "收件地址:$address{$value['address']['detail']}\n";
}
$data[$key]['copy_text'] = $copy_text;
}
}
$list['current_page'] = $result->currentPage();
$list['last_page'] = $result->lastPage();
$list['total'] = $result->total();
$list['data'] = $data;
return $this->renderSuccess(compact('list')); return $this->renderSuccess(compact('list'));
} }

@ -210,6 +210,28 @@ class StoreKeeper extends Controller
} }
$list['data'][$key]['transfer']['transfer_image_ids'] = $transfer_image_ids; $list['data'][$key]['transfer']['transfer_image_ids'] = $transfer_image_ids;
} }
//复制信息
$copy_text = "订单号:{$value['order_no']}\n";
foreach ($value['goods'] as $good) {
$copy_text .= "商品名称:{$good['goods_name']}\n";
if (!empty($good['goods_no'])) {
$copy_text .= "商品编号:{$good['goods_name']}\n";
}
$copy_text .= "商品单价:{$good['goods_price']}\n";
$copy_text .= "商品数量:{$good['total_num']}\n";
$copy_text .= "商品总价:{$good['total_price']}\n";
$copy_text .= "\n";
}
if (!empty($value['address'])) {
$copy_text .= "收件人:{$value['address']['name']}\n";
$copy_text .= "收件电话:{$value['address']['phone']}\n";
$address = '';
if (!empty($value['address']['region'])) {
$address = $value['address']['region']['province'] . $value['address']['region']['city'] . $value['address']['region']['region'];
}
$copy_text .= "收件地址:$address{$value['address']['detail']}\n";
}
$list['data']['copy_text'] = $copy_text;
} }
} }
return $this->renderSuccess(compact('dataType', 'list')); return $this->renderSuccess(compact('dataType', 'list'));

Loading…
Cancel
Save