添加订单标签导出功能
- 在 StoreOrderController 中新增 export_tags 方法,用于导出订单标签 - 在 Beforehand 类中调整字体样式大小
This commit is contained in:
parent
194fbbb2dd
commit
c370a96e60
app
@ -18,8 +18,10 @@ use app\common\model\store_order\StoreOrder;
|
|||||||
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
use app\common\model\store_order_cart_info\StoreOrderCartInfo;
|
||||||
use app\common\model\store_product\StoreProduct;
|
use app\common\model\store_product\StoreProduct;
|
||||||
use app\common\model\store_product_unit\StoreProductUnit;
|
use app\common\model\store_product_unit\StoreProductUnit;
|
||||||
|
use app\common\model\system_store\SystemStore;
|
||||||
use app\common\model\warehouse_order\WarehouseOrder;
|
use app\common\model\warehouse_order\WarehouseOrder;
|
||||||
use app\common\model\warehouse_product\WarehouseProduct;
|
use app\common\model\warehouse_product\WarehouseProduct;
|
||||||
|
use app\common\service\xlsx\Beforehand;
|
||||||
use app\common\service\xlsx\OrderDetail;
|
use app\common\service\xlsx\OrderDetail;
|
||||||
use support\exception\BusinessException;
|
use support\exception\BusinessException;
|
||||||
use think\facade\Db;
|
use think\facade\Db;
|
||||||
@ -252,4 +254,31 @@ class StoreOrderController extends BaseAdminController
|
|||||||
}
|
}
|
||||||
return $this->success('已导入后台队列,请在门店入库记录中查看', [], 1, 1);
|
return $this->success('已导入后台队列,请在门店入库记录中查看', [], 1, 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出标签
|
||||||
|
*/
|
||||||
|
public function export_tags()
|
||||||
|
{
|
||||||
|
$id = $this->request->post('id');
|
||||||
|
$order = StoreOrder::where('id', $id)->field('store_id,uid,real_name,user_address')->find();
|
||||||
|
|
||||||
|
$system_store = SystemStore::where('id', $order['store_id'])->value('introduction');
|
||||||
|
$data = StoreOrderCartInfo::where('oid', $id)->field('oid,product_id,cart_num')->select()
|
||||||
|
->each(function ($item) use ($system_store, $order) {
|
||||||
|
$find = StoreProduct::where('id', $item['product_id'])->field('store_name,unit')->find();
|
||||||
|
$unit_name = StoreProductUnit::where('id', $find['unit'])->value('name');
|
||||||
|
$item['system_store'] = $system_store;
|
||||||
|
$item['subtitle'] = $item['oid'] . ' ' . convertStringToNumber($item['cart_num']) . '/' . $unit_name;
|
||||||
|
$item['store_name'] = $find['store_name'];
|
||||||
|
if ($order['uid']) {
|
||||||
|
$item['address'] = $find['real_name'] . ' ' . $find['user_address'];
|
||||||
|
} else {
|
||||||
|
$item['address'] = '无地址';
|
||||||
|
}
|
||||||
|
})
|
||||||
|
->toArray();
|
||||||
|
$file_path = (new Beforehand())->export($data, $system_store);
|
||||||
|
return $this->success('导出成功', ['url' => $file_path]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ class Beforehand
|
|||||||
'marginTop' => Converter::cmToTwip(0.2),
|
'marginTop' => Converter::cmToTwip(0.2),
|
||||||
'marginBottom' => Converter::cmToTwip(0),
|
'marginBottom' => Converter::cmToTwip(0),
|
||||||
));
|
));
|
||||||
$fontStyle = ['name' => 'Arial', 'size' => 12, 'bold' => true];
|
$fontStyle = ['name' => 'Arial', 'size' => 10, 'bold' => true];
|
||||||
$fontStyle1 = ['name' => 'Arial', 'size' => 8, 'bold' => true];
|
$fontStyle1 = ['name' => 'Arial', 'size' => 8, 'bold' => true];
|
||||||
$fontStyle2 = ['name' => 'Arial', 'size' => 8, 'bold' => true];
|
$fontStyle2 = ['name' => 'Arial', 'size' => 8, 'bold' => true];
|
||||||
$fontStyle3 = ['name' => 'Arial', 'size' => 8, 'bold' => true];
|
$fontStyle3 = ['name' => 'Arial', 'size' => 8, 'bold' => true];
|
||||||
|
Loading…
x
Reference in New Issue
Block a user