You've already forked guangan
修改
This commit is contained in:
@ -32,7 +32,7 @@ class Order extends Controller
|
||||
}
|
||||
}, function (QueryHelper $query) {
|
||||
|
||||
$query->with(['user', 'from', 'items', 'address']);
|
||||
$query->with(['user', 'items', 'address']);
|
||||
|
||||
$query->equal('status,refund_status')->like('order_no');
|
||||
$query->dateBetween('create_time,payment_time,cancel_time,delivery_type');
|
||||
|
117
plugs/think-plugs-points-mall/src/controller/Sender.php
Normal file
117
plugs/think-plugs-points-mall/src/controller/Sender.php
Normal file
@ -0,0 +1,117 @@
|
||||
<?php
|
||||
|
||||
namespace plugin\points_mall\controller;
|
||||
|
||||
use plugin\account\model\PluginAccountBind;
|
||||
use plugin\points_mall\model\PointsMallOrder;
|
||||
use plugin\points_mall\model\PointsMallOrderSender;
|
||||
use think\admin\Controller;
|
||||
use think\admin\helper\QueryHelper;
|
||||
|
||||
/**
|
||||
* 订单发货管理
|
||||
* @class Sender
|
||||
* @package plugin\wemall\controller\shop
|
||||
*/
|
||||
class Sender extends Controller
|
||||
{
|
||||
/**
|
||||
* 订单状态
|
||||
* @var int[]
|
||||
*/
|
||||
private $oStatus = [4, 5, 6, 7];
|
||||
|
||||
/**
|
||||
* 订单发货管理
|
||||
* @auth true
|
||||
* @menu true
|
||||
* @throws \think\db\exception\DataNotFoundException
|
||||
* @throws \think\db\exception\DbException
|
||||
* @throws \think\db\exception\ModelNotFoundException
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$this->type = trim(input('type', 'ta'), 't');
|
||||
PointsMallOrderSender::mQuery()->layTable(function () {
|
||||
$this->title = '订单发货管理';
|
||||
$this->total = ['t0' => 0, 't1' => 0, 't2' => 0, 'ta' => 0];
|
||||
$this->address = sysdata('plugin.wemall.address');
|
||||
// 订单状态统计
|
||||
$order = PointsMallOrder::mk()->whereIn('status', $this->oStatus)->where(['delivery_type' => 1]);
|
||||
$query = PointsMallOrderSender::mk()->whereRaw("order_no in {$order->field('order_no')->buildSql()}");
|
||||
foreach ($query->fieldRaw('status,count(1) total')->group('status')->cursor() as $vo) {
|
||||
$this->total["ta"] += $vo['total'];
|
||||
$this->total["t{$vo['status']}"] = $vo['total'];
|
||||
}
|
||||
}, function (QueryHelper $query) {
|
||||
$query->with(['user', 'main']);
|
||||
$query->like('user_name|user_phone#user_name,region_prov|region_city|region_area|region_addr#address');
|
||||
$query->dateBetween('create_time,express_time')->equal('status')->like('express_code,order_no');
|
||||
|
||||
// 用户搜索查询
|
||||
$db = PluginAccountBind::mQuery()->like('phone|nickname#user_keys')->db();
|
||||
if ($db->getOptions('where')) $query->whereRaw("unid in {$db->field('id')->buildSql()}");
|
||||
|
||||
// 订单搜索查询
|
||||
$db = PointsMallOrder::mk()->whereIn('status', $this->oStatus)->where(['delivery_type' => 1]);
|
||||
$query->whereRaw("order_no in {$db->field('order_no')->buildSql()}");
|
||||
|
||||
// 列表选项卡状态
|
||||
if (is_numeric($this->type)) {
|
||||
$query->where(['status' => $this->type]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递发货地址
|
||||
* @auth true
|
||||
* @throws \think\admin\Exception
|
||||
*/
|
||||
public function config()
|
||||
{
|
||||
if ($this->request->isGet()) {
|
||||
$this->vo = sysdata('plugin.wemall.address');
|
||||
$this->fetch();
|
||||
} else {
|
||||
sysdata('plugin.wemall.address', $this->request->post());
|
||||
$this->success('地址保存成功!');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改快递管理
|
||||
* @auth true
|
||||
*/
|
||||
public function delivery()
|
||||
{
|
||||
PointsMallOrderSender::mForm('delivery_form', 'order_no');
|
||||
}
|
||||
|
||||
/**
|
||||
* 快递表单处理
|
||||
* @param array $vo
|
||||
*/
|
||||
protected function _delivery_form_filter(array &$vo)
|
||||
{
|
||||
if ($this->request->isGet()) {
|
||||
$map = ['code' => $vo['delivery_code'], 'status' => 1, 'deleted' => 0];
|
||||
} elseif ($this->request->isPost()) {
|
||||
$map = ['order_no' => $vo['order_no']];
|
||||
$order = PointsMallOrder::mk()->where($map)->findOrEmpty();
|
||||
if ($order->isEmpty()) $this->error('订单查询异常,请稍候再试!');
|
||||
|
||||
// 追加表单数据
|
||||
$vo['status'] = 2;
|
||||
// $vo['company_name'] = "";
|
||||
$vo['express_time'] = $vo['express_time'] ?? date('Y-m-d H:i:s');
|
||||
|
||||
$vo['region_prov'] = $vo['form_prov'] ?? '';
|
||||
$vo['region_city'] = $vo['form_city'] ?? '';
|
||||
$vo['region_area'] = $vo['form_area'] ?? '';
|
||||
|
||||
// 更新订单发货状态
|
||||
if ($order['status'] === 4) $order->save(['status' => 5]);
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
|
||||
namespace plugin\points_mall\controller\api\auth;
|
||||
|
||||
use app\wechat\service\PaymentService;
|
||||
use plugin\points_mall\controller\api\Auth;
|
||||
use plugin\points_mall\model\PointsMallAddress;
|
||||
use plugin\points_mall\model\PointsMallGoods;
|
||||
@ -101,8 +102,8 @@ class Order extends Auth
|
||||
$order['amount_cost'] = array_sum(array_column($items, 'total_price_cost'));
|
||||
$order['amount_goods'] = array_sum(array_column($items, 'total_price_selling'));
|
||||
// 折扣后的金额
|
||||
$order['amount_discount'] = array_sum(array_column($items, 'discount_amount'));
|
||||
$order['amount_reduct'] = $order['amount_goods'];
|
||||
$order['amount_discount'] = array_sum(array_column($items, 'total_price_cost'));
|
||||
$order['amount_reduct'] = 0;
|
||||
// 统计订单金额
|
||||
$order['amount_real'] = round($order['amount_discount'] - $order['amount_reduct'], 2);
|
||||
$order['amount_total'] = $order['amount_goods'];
|
||||
@ -355,7 +356,7 @@ class Order extends Auth
|
||||
empty($data['order_ps']) || $order->save(['order_ps' => $data['order_ps']]);
|
||||
|
||||
// 无需支付,直接完成订单
|
||||
if (floatval($orderAmount = $order->getAttr('amount_real')) <= 0) {
|
||||
if (floatval($orderAmount = $order->getAttr('amount_total')) <= 0) {
|
||||
$order->save(['status' => 4]);
|
||||
$this->success('已支付成功!', []);
|
||||
}
|
||||
@ -394,12 +395,12 @@ class Order extends Auth
|
||||
// $response = Payment::mk(payment::INTEGRAL)->create($this->account, $data['order_no'], '账号积分抵扣', $orderAmount, $data['integral']);
|
||||
// if (($leaveAmount = Payment::leaveAmount($data['order_no'], $orderAmount)) <= 0) $this->success('已完成支付!', $response->toArray());
|
||||
// }
|
||||
$userPoint = UserPointService::getUserPoint($this->unid);
|
||||
if ($userPoint['point'] < $leaveAmount) {
|
||||
$userPoint = UserPointService::getUserPoint($this->usid);
|
||||
if ($userPoint < $leaveAmount) {
|
||||
$this->error("积分不足!");
|
||||
} else {
|
||||
$order->save(['status' => 4]);
|
||||
UserPointService::addUserPoint($this->unid, -$leaveAmount, '积分购买商品抵扣');
|
||||
UserPointService::addUserPoint($this->usid, -$leaveAmount, '积分购买商品抵扣');
|
||||
$this->success('积分抵扣成功!', []);
|
||||
}
|
||||
|
||||
@ -456,7 +457,6 @@ class Order extends Auth
|
||||
];
|
||||
if ($order->save($data) && UserOrderService::stock($order->getAttr('order_no'))) {
|
||||
// 触发订单取消事件
|
||||
Payment::refund($order->getAttr('order_no'));
|
||||
$this->app->event->trigger('PluginWemallOrderCancel', $order);
|
||||
// 返回处理成功数据
|
||||
$this->success('取消成功!');
|
||||
@ -584,7 +584,7 @@ class Order extends Auth
|
||||
*/
|
||||
private function getOrderModel(): PointsMallOrder
|
||||
{
|
||||
$map = $this->_vali(['unid.value' => $this->unid, 'order_no.require' => '单号不能为空']);
|
||||
$map = $this->_vali(['unid.value' => $this->usid, 'order_no.require' => '单号不能为空']);
|
||||
$order = PointsMallOrder::mk()->where($map)->findOrEmpty();
|
||||
if ($order->isEmpty()) $this->error('读取订单失败!');
|
||||
return $order;
|
||||
|
@ -2,18 +2,16 @@
|
||||
|
||||
namespace plugin\points_mall\model;
|
||||
|
||||
use plugin\account\model\PluginAccountBind;
|
||||
use plugin\account\model\PluginAccountUser;
|
||||
use think\admin\Model;
|
||||
|
||||
class PointsMallOrder extends Model
|
||||
{
|
||||
/**
|
||||
* 关联推荐用户
|
||||
* @return \think\model\relation\HasOne
|
||||
*/
|
||||
public function from()
|
||||
|
||||
public function user()
|
||||
{
|
||||
return $this->hasOne(PluginAccountUser::class, 'id', 'puid1');
|
||||
return $this->hasOne(PluginAccountBind::class, 'id', 'unid');
|
||||
}
|
||||
|
||||
/**
|
||||
@ -51,7 +49,7 @@ class PointsMallOrder extends Model
|
||||
*/
|
||||
public function address()
|
||||
{
|
||||
return $this->hasOne(PointsMallAddress::class, 'id', 'address_id');
|
||||
return $this->hasOne(PointsMallOrderSender::class, 'order_no', 'order_no');
|
||||
}
|
||||
public function sender()
|
||||
{
|
||||
|
@ -2,11 +2,15 @@
|
||||
|
||||
namespace plugin\points_mall\model;
|
||||
|
||||
use plugin\account\model\PluginAccountBind;
|
||||
use think\admin\Model;
|
||||
|
||||
class PointsMallOrderSender extends Model
|
||||
{
|
||||
|
||||
public function user() {
|
||||
return $this->hasOne(PluginAccountBind::class, 'id', 'unid');
|
||||
}
|
||||
/**
|
||||
* 关联订单数据
|
||||
* @return \think\model\relation\HasOne
|
||||
|
@ -54,61 +54,21 @@
|
||||
return laytpl("<div class='nowrap ta-pt-10'>" + tpls.join('') + "</div>").render(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '推广用户', width: 170, templet: function (d) {
|
||||
let tpls = [];
|
||||
if (d.from) {
|
||||
tpls.push('<div>用户昵称:{{d.from.nickname||d.from.username||"-"}}</div>');
|
||||
tpls.push('<div>用户手机:<b class="font-code">{{d.from.phone}}</b></div>');
|
||||
} else {
|
||||
tpls.push('<div class="color-desc ta-pt-10">无推荐人</div>')
|
||||
}
|
||||
return laytpl("<div class='nowrap ta-pt-10'>" + tpls.join('') + "</div>").render(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '订单信息', minWidth: 250, templet: function (d) {
|
||||
d.showPayments = "{:url('plugin-payment/record/index')}"
|
||||
let tpls = ' <a data-tips-text="查看支付信息" data-title="查看支付信息" class="layui-icon layui-icon-rmb font-s12 ta-mr-5" data-width="999px" data-close-refresh="OrderTable" data-modal="{{d.showPayments}}?orderinfo={{d.order_no}}"></a>';
|
||||
tpls += '订单号 <b class="font-code">{{d.order_no}}</b>';
|
||||
if (d.amount_real > 0) {
|
||||
if (d.payment_status > 0) {
|
||||
tpls += '<br>已支付 <b class="font-code" data-width="1024px" data-title="查看支付详情">{{str2num(d.amount_real)}}</b> 元';
|
||||
} else {
|
||||
tpls += '<br>需支付 <b class="font-code" data-width="1024px" data-title="查看支付详情">{{str2num(d.amount_real)}}</b> 元';
|
||||
}
|
||||
} else {
|
||||
tpls += '<br>无需支付';
|
||||
}
|
||||
if (d.amount_express > 0) {
|
||||
tpls += ' ( 随减 <b class="font-code">{{str2num(d.amount_reduct)}}</b> 元,含邮费 <b class="font-code">{{str2num(d.amount_express)}}</b> 元)';
|
||||
} else {
|
||||
tpls += ' ( 随减 <b class="font-code">{{str2num(d.amount_reduct)}}</b> 元,包邮免费 )';
|
||||
}
|
||||
let tpls = '订单号 <b class="font-code">{{d.order_no}}</b>';
|
||||
tpls += '<br>'
|
||||
if (d.amount_balance > 0) {
|
||||
tpls += "余额 " + d.amount_balance + " 元,"
|
||||
if (d.amount_total > 0) {
|
||||
tpls += "使用积分 " + d.amount_total + ""
|
||||
} else {
|
||||
tpls += '未使用余额,'
|
||||
}
|
||||
if (d.amount_integral > 0) {
|
||||
tpls += "积分 " + d.amount_balance + ","
|
||||
} else {
|
||||
tpls += '未使用积分,'
|
||||
}
|
||||
if (d.coupon_code) {
|
||||
tpls += "优惠券 " + d.coupon_amount + "元,"
|
||||
} else {
|
||||
tpls += '未使用优惠券。'
|
||||
tpls += '未使用积分'
|
||||
}
|
||||
|
||||
let status = laytpl('<span class="layui-badge layui-badge-middle flex-center {{d.style}}" >{{d.status}}</span>').render({
|
||||
status: ostatus[d.status], style: ostyles[d.status]
|
||||
});
|
||||
let refund = laytpl('<span class="layui-badge layui-badge-middle flex-center {{d.style}}">{{d.status}}</span>').render({
|
||||
status: rstatus[d.refund_status], style: rstyles[d.refund_status]
|
||||
});
|
||||
return '<div class="flex" style="margin-top:-4px">' + status + refund + '<div class="nowrap sub-strong-blue">' + laytpl(tpls).render(d) + '</div></div>';
|
||||
return '<div class="flex" style="margin-top:-4px">' + status + '<div class="nowrap sub-strong-blue">' + laytpl(tpls).render(d) + '</div></div>';
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -124,7 +84,7 @@
|
||||
' <div>' +
|
||||
' <span>{{d.gname}}</span>' +
|
||||
' <span class="ta-pl-5 color-desc">{{str2name(d.gspec)}}</span><br>' +
|
||||
' <span>{{d.stock_sales}}件 x {{str2num(d.price_selling)}}元/件,计 {{str2num(d.total_price_selling)}}元</span> ' +
|
||||
' <span>{{d.stock_sales}}件 x {{str2num(d.price_selling)}}积分/件,计 {{str2num(d.total_price_selling)}}积分</span> ' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
'</div>'
|
||||
@ -150,7 +110,7 @@
|
||||
}
|
||||
}
|
||||
},
|
||||
{field: 'id', sort: true, title: '创建时间', minWidth: 170, templet: "下单时间:{{d.create_time}}<br><div>支付时间:{{d.payment_time}}<br>签收时间:{{d.confirm_time}}</div>"},
|
||||
{field: 'id', sort: true, title: '创建时间', minWidth: 170, templet: "下单时间:{{d.create_time}}<br><div>签收时间:{{d.confirm_time}}</div>"},
|
||||
{toolbar: '#toolbar', hide: true, title: '操作面板', width: 120, align: 'center', fixed: 'right'},
|
||||
]]
|
||||
});
|
||||
|
@ -0,0 +1,78 @@
|
||||
<form action="{:sysuri()}" id="AddressConfigForm" data-table-id="SenderTable" method="post" data-auto="true" class="layui-form layui-card">
|
||||
<div class="layui-card-body ta-pl-40">
|
||||
<fieldset class="layui-form-item layui-bg-gray">
|
||||
<legend><span class="layui-badge layui-bg-cyan">收货信息</span></legend>
|
||||
<div class="layui-form-item layui-row layui-col-space10">
|
||||
|
||||
<label class="layui-col-xs6 relative block">
|
||||
<span class="help-label label-required-prev"><b>收货人姓名</b>User Name</span>
|
||||
<input class="layui-input" name="user_name" vali-name="收货人姓名" placeholder="请输入收货姓名" required value="{$vo.user_name|default=''}">
|
||||
</label>
|
||||
|
||||
<label class="layui-col-xs6 relative block">
|
||||
<span class="help-label label-required-prev"><b>收货人手机</b>User Mobile</span>
|
||||
<input class="layui-input" name="user_phone" vali-name="收货人手机" pattern="mobile" placeholder="请输入收货人手机" required value="{$vo.user_phone|default=''}">
|
||||
</label>
|
||||
|
||||
<div class="layui-col-xs12 relative block">
|
||||
<span class="help-label"><b>收货所在区域</b>(原区域:{$vo.extra.region_prov|default='--'} - {$vo.extra.region_city|default=''} - {$vo.extra.region_area|default=''} )</span>
|
||||
<div class="layui-row layui-col-space10">
|
||||
<label class="layui-col-xs4"><select class="layui-select" lay-filter="form_prov" name="form_prov"></select></label>
|
||||
<label class="layui-col-xs4"><select class="layui-select" lay-filter="form_city" name="form_city"></select></label>
|
||||
<label class="layui-col-xs4"><select class="layui-select" lay-filter="form_area" name="form_area"></select></label>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<label class="layui-col-xs12 relative block">
|
||||
<span class="help-label"><b>收货详细地址</b>(原地址:{$vo.extra.region_addr|default=""} )</span>
|
||||
<input class="layui-input" name="region_addr" placeholder="请输入收货地址" required value='{$vo.region_addr|default=""}'>
|
||||
</label>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
<fieldset class="layui-form-item layui-bg-gray">
|
||||
<legend>
|
||||
<span class="layui-badge layui-bg-cyan">快递信息</span>
|
||||
</legend>
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>快递配送公司</b>Express Company</span>
|
||||
<input class="layui-input" data-delivery-number vali-name="快递配送公司" name="company_name" placeholder="请输入快递配送公司" required value='{$vo.company_name|default=""}'>
|
||||
</label>
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>快递配送单号</b>Express Number</span>
|
||||
<input class="layui-input" data-delivery-number vali-name="快递配送单号" name="express_code" placeholder="请输入快递配送单号" required value='{$vo.express_code|default=""}'>
|
||||
</label>
|
||||
|
||||
<label class="layui-form-item relative block">
|
||||
<span class="help-label"><b>快递配送描述</b>Express Description</span>
|
||||
<textarea class="layui-textarea" name="express_remark" placeholder="请输入快递配送描述">{$vo.express_remark|default=""}</textarea>
|
||||
</label>
|
||||
</fieldset>
|
||||
</div>
|
||||
|
||||
<div class="hr-line-dashed"></div>
|
||||
{notempty name='vo.order_no'}<input name='order_no' type='hidden' value='{$vo.order_no}'>{/notempty}
|
||||
{notempty name='vo.express_time'}<input name='express_time' type='hidden' value='{$vo.express_time}'>{/notempty}
|
||||
|
||||
<div class="layui-form-item text-center">
|
||||
<button class="layui-btn" type='submit'>保存数据</button>
|
||||
<button class="layui-btn layui-btn-danger" data-close data-confirm="确定要取消编辑吗?" type='button'>取消编辑</button>
|
||||
</div>
|
||||
|
||||
</form>
|
||||
|
||||
<script>
|
||||
require(['pcasunzips'], function () {
|
||||
(function (prov, city, area, call) {
|
||||
new PCAS('form_prov', 'form_city', 'form_area', prov, city, area);
|
||||
$('#AddressConfigForm').parents('.layui-layer-content').css({overflow: 'unset'});
|
||||
call() && form.on('select(form_prov)', call) && form.on('select(form_city)', call) && form.on('select(form_area)', call);
|
||||
})('{$vo.region_prov|default=""}', '{$vo.region_city|default=""}', '{$vo.region_area|default=""}', function (data) {
|
||||
$('select:not([lay-ignore])').next('.layui-form-select').remove();
|
||||
data && data.elem && $(data.elem).trigger('change');
|
||||
return layui.form.render('select');
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
160
plugs/think-plugs-points-mall/src/view/sender/index.html
Normal file
160
plugs/think-plugs-points-mall/src/view/sender/index.html
Normal file
@ -0,0 +1,160 @@
|
||||
{extend name="table"}
|
||||
|
||||
{block name="button"}
|
||||
{/block}
|
||||
|
||||
{block name="content"}
|
||||
<div class="layui-tab layui-tab-card">
|
||||
<ul class="layui-tab-title notselect">
|
||||
{foreach ['ta'=>'全部订单','t1'=>'等待发货','t2'=>'已经发货','t3'=>'已经收货'] as $k => $v}
|
||||
{if isset($type) and 't'.$type eq $k}
|
||||
<li class="layui-this" data-open="{:url('index')}?type={$k}">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
|
||||
{else}
|
||||
<li data-open="{:url('index')}?type={$k}">{$v}<sup class="layui-badge border-radius">{$total[$k]??0}</sup></li>
|
||||
{/if}{/foreach}
|
||||
</ul>
|
||||
<div class="layui-tab-content">
|
||||
{include file='sender/index_search'}
|
||||
<table id="SenderTable" data-line="3" data-url="{:request()->url()}" data-target-search="form.form-search"></table>
|
||||
</div>
|
||||
</div>
|
||||
{/block}
|
||||
|
||||
{block name='script'}
|
||||
<script>
|
||||
|
||||
function str2num(v) {
|
||||
return parseFloat(v);
|
||||
}
|
||||
|
||||
function str2name(v) {
|
||||
let _ = [];
|
||||
v.split(';;').forEach(s => _.push(s.split('::').pop()));
|
||||
return _.join(' ');
|
||||
}
|
||||
|
||||
let tstatus = ['已取消', '待发货', '已发货', '已收货'];
|
||||
let tstyles = ['layui-bg-gray layui-border-red', 'layui-bg-black', 'layui-bg-blue', 'layui-bg-green'];
|
||||
|
||||
$(function () {
|
||||
$('#SenderTable').layTable({
|
||||
even: true, height: 'full', sort: {field: 'id', type: 'desc'},
|
||||
cols: [[
|
||||
{field: 'headimg', title: '头 像', width: 90, align: 'center', templet: '<div>{{-showTableImage(d.user.headimg,true,"md")}}</div>'},
|
||||
{
|
||||
field: 'unid', title: '会员用户', width: 170, templet: function (d) {
|
||||
let tpls = [];
|
||||
if (d.user) {
|
||||
tpls.push('<div>用户昵称:{{d.user.nickname||d.user.username||"-"}}</div>');
|
||||
tpls.push('<div>用户手机:<b class="font-code">{{d.user.phone}}</b></div>');
|
||||
} else {
|
||||
tpls.push('<div class="color-desc ta-pt-10">无用户账号</div>')
|
||||
}
|
||||
return laytpl("<div class='nowrap ta-pt-10'>" + tpls.join('') + "</div>").render(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'order_no', title: '订单信息', minWidth: 100, templet: function (d) {
|
||||
let status = laytpl('<span class="layui-badge layui-badge-middle flex-center {{d.style}}">{{d.status}}</span>').render({
|
||||
status: tstatus[d.status], style: tstyles[d.status]
|
||||
});
|
||||
// status += laytpl('<span class="layui-badge layui-badge-middle flex-center {{d.style}}" style="zoom:85%;line-height:15px;padding:3px 4px">{{d.status}}</span>').render({
|
||||
// status: ostatus[d.main.status], style: ostyles[d.main.status]
|
||||
// });
|
||||
let tpls = '订单号 <b class="font-code">{{d.main.order_no}}</b> ';
|
||||
if (d.main.amount_real > 0) {
|
||||
if (d.main.status > 3) {
|
||||
tpls += '<br>已支付 <b class="font-code">{{str2num(d.main.amount_real)}}</b> 元';
|
||||
} else {
|
||||
tpls += '<br>需支付 <b class="font-code">{{str2num(d.main.amount_real)}}</b> 元';
|
||||
}
|
||||
} else {
|
||||
tpls += '<br>无需支付';
|
||||
}
|
||||
if (d.main.amount_express > 0) {
|
||||
tpls += ' ( 随减 <b class="font-code">{{str2num(d.main.amount_reduct)}}</b> 元,含邮费 <b class="font-code">{{str2num(d.main.amount_express)}}</b> 元)';
|
||||
} else {
|
||||
tpls += ' ( 随减 <b class="font-code">{{str2num(d.main.amount_reduct)}}</b> 元,包邮免费 )';
|
||||
}
|
||||
tpls += '<br>'
|
||||
if (d.main.amount_balance > 0) {
|
||||
tpls += "余额 " + d.main.amount_balance + " 元,"
|
||||
} else {
|
||||
tpls += '未使用余额,'
|
||||
}
|
||||
if (d.main.amount_integral > 0) {
|
||||
tpls += "积分 " + d.main.amount_balance + ","
|
||||
} else {
|
||||
tpls += '未使用积分,'
|
||||
}
|
||||
if (d.main.coupon_code) {
|
||||
tpls += "优惠券 " + d.main.coupon_amount + "元,"
|
||||
} else {
|
||||
tpls += '未使用优惠券。'
|
||||
}
|
||||
return '<div class="flex">' + status + '<div class="nowrap sub-strong-blue">' + laytpl(tpls).render(d) + '</div></div>';
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '商品详情', templet: function (d) {
|
||||
let tpls = [];
|
||||
d.main.items.forEach(function (v) {
|
||||
tpls.push(laytpl(
|
||||
'<div class="flex">' +
|
||||
' <div style="padding-top:3px">{{-showTableImage(d.gcover,false,"md")}}</div>' +
|
||||
' <div class="ta-pl-5"></div>' +
|
||||
' <div>' +
|
||||
' <div>{{d.gcode}}</div>' +
|
||||
' <div>' +
|
||||
' <span>{{d.gname}}</span>' +
|
||||
' <span class="ta-pl-5 color-desc">{{str2name(d.gspec)}}</span><br>' +
|
||||
' <span>{{d.stock_sales}}件 x {{str2num(d.price_selling)}}元/件,计 {{str2num(d.total_price_selling)}}元</span> ' +
|
||||
' </div>' +
|
||||
' </div>' +
|
||||
'</div>'
|
||||
).render(v));
|
||||
});
|
||||
return tpls.join('<br>');
|
||||
}
|
||||
},
|
||||
{
|
||||
title: '物流信息', templet: function (d) {
|
||||
let tpls = [];
|
||||
if (d.status > 1) {
|
||||
tpls.push('<b>发货物流:</b><span class="ta-mr-5">{{d.company_name}}</span><b class="color-blue font-code">{{d.express_code}}</b>');
|
||||
} else {
|
||||
tpls.push('<b>发货物流:</b><span class="color-desc">未发货</span>');
|
||||
}
|
||||
tpls.push('<b>联系方式:</b><span class="ta-mr-5">{{d.user_name}}</span><span class="color-blue font-code">{{d.user_phone}}</span>');
|
||||
tpls.push('<b>收货地址:</b>{{d.region_prov}} {{d.region_city}} {{d.region_area}} {{d.region_addr}}');
|
||||
return laytpl(tpls.join('<br>')).render(d);
|
||||
}
|
||||
},
|
||||
{
|
||||
field: 'id', sort: true, title: '创建时间', minWidth: 170, templet: function (d) {
|
||||
let tpls = [];
|
||||
tpls.push('发货时间:{{d.express_time}}');
|
||||
tpls.push('创建时间:{{d.create_time}}');
|
||||
tpls.push('更新时间:{{d.update_time}}');
|
||||
return laytpl(tpls.join('<br>')).render(d)
|
||||
}
|
||||
},
|
||||
/* {if auth('delivery')} */
|
||||
{toolbar: '#toolbar', title: '操作面板', width: 100, align: 'center', fixed: 'right'},
|
||||
/* {/if} */
|
||||
]]
|
||||
});
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/html" id="toolbar">
|
||||
<div class="ta-pt-10"></div>
|
||||
<!--{if auth('delivery')}-->
|
||||
{{# if(d.status < 2){ }}
|
||||
<a class="layui-btn layui-btn-sm" data-title="发货快递管理" data-modal="{:url('delivery')}" data-value="order_no#{{d.order_no}}">发 货</a>
|
||||
{{# }else{ }}
|
||||
<a class="layui-btn layui-btn-sm" data-title="发货快递管理" data-modal="{:url('delivery')}" data-value="order_no#{{d.order_no}}">修 改</a>
|
||||
{{# } }}
|
||||
<!--{/if}-->
|
||||
</script>
|
||||
{/block}
|
111
plugs/think-plugs-points-mall/src/view/sender/index_search.html
Normal file
111
plugs/think-plugs-points-mall/src/view/sender/index_search.html
Normal file
@ -0,0 +1,111 @@
|
||||
<form action="{:sysuri()}" autocomplete="off" class="layui-form layui-form-pane form-search" method="get" onsubmit="return false">
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">会员用户</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="user_keys" placeholder="请输入手机或昵称" value="{$get.user_keys|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">订单单号</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="order_no" placeholder="请输入订单单号" value="{$get.order_no|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">发货单号</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="delivery_count" placeholder="请输入发货单号" value="{$get.delivery_count|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">发货状态</label>
|
||||
<label class="layui-input-inline">
|
||||
<select class="layui-select" name="status">
|
||||
<option value="">-- 全部 --</option>
|
||||
{foreach [1=>'等待发货',2=>'已经发货',3=>'已经收货'] as $k=>$v}
|
||||
{if isset($get.status) and $get.status eq $k.''}
|
||||
<option selected value="{$k}">{$v}</option>
|
||||
{else}
|
||||
<option value="{$k}">{$v}</option>
|
||||
{/if}{/foreach}
|
||||
</select>
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">创建时间</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" data-date-range name="create_time" placeholder="请选择创建时间" value="{$get.create_time|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">发货时间</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" data-date-range name="express_time" placeholder="请选择发货时间" value="{$get.express_time|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">收货信息</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="user_name" placeholder="请输入收货信息" value="{$get.user_name|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<label class="layui-form-label">配送地址</label>
|
||||
<label class="layui-input-inline">
|
||||
<input class="layui-input" name="address" placeholder="请输入配送地址" value="{$get.address|default=''}">
|
||||
</label>
|
||||
</div>
|
||||
|
||||
<div class="layui-form-item layui-inline">
|
||||
<button class="layui-btn layui-btn-primary" type="submit"><i class="layui-icon"></i> 搜 索</button>
|
||||
<button class="layui-btn layui-btn-primary" data-form-export="{:url('index')}?type={$type|default=''}" type="button">
|
||||
<i class="layui-icon layui-icon-export"></i> 导 出
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
|
||||
<script>
|
||||
require(['excel'], function (excel) {
|
||||
excel.bind(function (data) {
|
||||
let rows = [];
|
||||
data.forEach(function (delivery) {
|
||||
delivery.main.items.forEach(function (item) {
|
||||
rows.push([
|
||||
item.order_no,
|
||||
item.gname,
|
||||
item.gsku,
|
||||
item.gspec,
|
||||
item.stock_sales,
|
||||
item.price_selling,
|
||||
item.total_selling,
|
||||
'{$address.name|default=""}',
|
||||
delivery.user_name,
|
||||
delivery.user_phone,
|
||||
delivery.region_prov,
|
||||
delivery.region_city,
|
||||
delivery.region_area,
|
||||
delivery.region_addr,
|
||||
]);
|
||||
});
|
||||
});
|
||||
|
||||
// 设置表头内容
|
||||
rows.unshift([
|
||||
'订单号', '商品名称', '商品SKU编码', '商品规格', '数量', '单价', '总额',
|
||||
'寄件方', '收货人', '电话', '省份', '城市', '区', '地址'
|
||||
]);
|
||||
|
||||
// 应用表格样式
|
||||
return this.withStyle(rows);
|
||||
|
||||
}, '订单发货记录' + layui.util.toDateString(Date.now(), '_yyyyMMdd_HHmmss'));
|
||||
});
|
||||
</script>
|
Reference in New Issue
Block a user