修改快递查询

This commit is contained in:
Anyon 2020-09-12 15:35:55 +08:00
parent f58dd067a3
commit d50010f87f
4 changed files with 18 additions and 21 deletions

View File

@ -133,12 +133,11 @@ class ShopOrder extends Controller
{
try {
$data = $this->_vali([
'code.require' => '快递公司不能为空!',
'number.require' => '配送单号不能为空!',
'code.require' => '快递编号不能为空!', 'number.require' => '配送单号不能为空!',
]);
$this->result = OrderService::instance()->trackExpress($data['code'], $data['number']);
if (empty($this->result['code'])) $this->error($this->result['info']);
$this->fetch();
$this->fetch('truck_query');
} catch (HttpResponseException $exception) {
throw $exception;
} catch (\Exception $exception) {
@ -147,7 +146,7 @@ class ShopOrder extends Controller
}
/**
* 取消单并创建售后
* 取消未支付的订单
* @auth true
* @throws \think\db\exception\DataNotFoundException
* @throws \think\db\exception\DbException
@ -158,20 +157,18 @@ class ShopOrder extends Controller
$map = $this->_vali(['order_no.require' => '订单编号不能为空!']);
$order = $this->app->db->name($this->table)->where($map)->find();
if (empty($order)) $this->error('订单查询异常');
if (intval($order['status']) !== 3) $this->error('该订单不能发货!');
[$rules, $data] = [[], ['type' => 3, 'refund_content' => '后台操作取消订单并申请退款', 'refund_images' => '']];
foreach ($this->app->db->name("{$this->table}Item")->where($map)->select()->toArray() as $item) {
$rules[] = ['goods_code' => $item['goods_code'], 'goods_spec' => $item['goods_spec'], 'refund_number' => $item['stock_sales']];
}
if (!in_array($order['status'], [1, 2])) $this->error('订单不能取消!');
try {
if (OrderService::instance()->refund($order['order_no'], $data, $rules)) {
$this->app->db->name($this->table)->where($map)->update([
'status' => 0,
'cancel_status' => 1,
'cancel_remark' => '后台取消并创建退款申请',
'cancel_datetime' => date('Y-m-d H:i:s'),
]);
$this->success('取消订单并创建退款申请成功!');
$result = $this->app->db->name($this->table)->where($map)->update([
'status' => 0,
'cancel_status' => 1,
'cancel_remark' => '后台未支付的取消',
'cancel_datetime' => date('Y-m-d H:i:s'),
]);
if ($result !== false) {
$this->success('取消未支付的订单成功!');
} else {
$this->error('取消支付的订单失败!');
}
} catch (HttpResponseException $exception) {
throw $exception;

View File

@ -37,14 +37,14 @@
<img data-tips-image style="width:35px;height:35px" src="{$vo.fromer.headimg|default='__ROOT__/static/theme/img/headimg.png'}" class="margin-right-5" alt="img">
<div class="inline-block text-middle sub-span-blue">
推荐会员:{$vo.fromer.nickname|default='--'}<br>
推荐手机:<span>{$vo.fromer.phone|default='--'}</span>{notempty name='vo.fromer.vip_level'} [ <b class="color-red">VIP{$vo.fromer.vip_level}</b> ] <b class="color-red">{$vo.fromer.vip_title}</b>{/notempty}<br>
推荐手机:<span>{$vo.fromer.phone|default='--'}</span><br>
</div>
</div>
<div>
<img data-tips-image style="width:35px;height:35px" src="{$vo.member.headimg|default='__ROOT__/static/theme/img/headimg.png'}" class="margin-right-5" alt="img">
<div class="inline-block text-middle sub-span-blue">
会员昵称:{$vo.member.nickname|default='--'}<br>
会员手机:<span>{$vo.member.phone|default='--'}</span>{notempty name='vo.member.vip_level'} [ <b class="color-red">VIP{$vo.member.vip_level}</b> ] <b class="color-red">{$vo.member.vip_title}</b>{/notempty}<br>
会员手机:<span>{$vo.member.phone|default='--'}</span><br>
</div>
</div>
</td>
@ -76,9 +76,9 @@
class="layui-badge layui-bg-orange margin-left-5">{$vo.truck_send_no|default='--'}</a>
{/if}
{if $vo.status eq 3}
<a class="margin-left-5" data-title="填写订单信息" data-modal="{:url('express')}?order_no={$vo.order_no}">填写发货</a>
<a class="margin-left-5" data-title="填写订单信息" data-modal="{:url('truck')}?order_no={$vo.order_no}">填写发货</a>
{elseif $vo.status eq 4}
<a class="margin-left-5" data-title="修改发货信息" data-modal="{:url('express')}?order_no={$vo.order_no}">修改发货</a>
<a class="margin-left-5" data-title="修改发货信息" data-modal="{:url('truck')}?order_no={$vo.order_no}">修改发货</a>
{/if}
<!--{if auth('cancel') and in_array($vo.status, [1,2])}-->
<a class="margin-left-5" data-confirm="确认要取消订单吗?" data-load="{:url('cancel')}?order_no={$vo.order_no}">取消订单</a>