|
@@ -137,19 +137,35 @@ class My extends Core
|
|
|
# 获取订单详细信息
|
|
|
public function order_info($info, $type = 1)
|
|
|
{
|
|
|
+ if ($info['status'] == 1) {
|
|
|
+ # 15分钟内支付,900秒
|
|
|
+ $m = 9000;
|
|
|
+ # 支付倒计时
|
|
|
+ $info['time'] = time() - $info['cdate'];
|
|
|
+ if ($info['time'] >= $m) {
|
|
|
+ # 已过期,自动取消
|
|
|
+ $info['time'] = -1;
|
|
|
+ Dever::db('shop/sell_order')->update(array('where_id' => $info['id'], 'status' => 11));
|
|
|
+ $info['status'] = 11;
|
|
|
+ } else {
|
|
|
+ $info['time'] = $m - $info['time'];
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
$info['status_name'] = $this->config['status'][$info['status']];
|
|
|
$info['method_name'] = $this->config['method'][$info['method']];
|
|
|
|
|
|
- if ($info['method'] == 1 && $info['status'] > 1) {
|
|
|
-
|
|
|
+ if ($info['method'] == 2 && $info['status'] > 1) {
|
|
|
+ # 如果是外送,需要读取外送单号
|
|
|
}
|
|
|
+
|
|
|
$info['goods'] = Dever::db('shop/sell_order_goods')->select(array('order_id' => $info['id']));
|
|
|
$info['shop'] = Dever::db('shop/info')->getOne($info['shop_id']);
|
|
|
$info['cdate'] = date('Y-m-d H:i', $info['cdate']);
|
|
|
|
|
|
if ($type == 2) {
|
|
|
foreach ($info['goods'] as $k => $v) {
|
|
|
- $info['goods']['info'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
|
|
|
+ $info['goods'][$k]['info'] = Dever::load('goods/lib/info')->getPayInfo($v['goods_id'], $v['sku_id']);
|
|
|
}
|
|
|
if ($info['address_id']) {
|
|
|
$info['address'] = Dever::db('passport/address')->find($info['address_id']);
|
|
@@ -179,10 +195,58 @@ class My extends Core
|
|
|
if (!$this->data) {
|
|
|
Dever::alert('订单不存在');
|
|
|
}
|
|
|
+ if ($this->data['status'] == 1) {
|
|
|
+ Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 5));
|
|
|
+
|
|
|
+ return 'ok';
|
|
|
+ } else {
|
|
|
+ Dever::alert('当前订单状态不允许取消');
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ # 退款退货
|
|
|
+ public function order_tui()
|
|
|
+ {
|
|
|
+ $id = Dever::input('order_id');
|
|
|
+
|
|
|
+ $this->data = Dever::db('shop/sell_order')->find(array('uid' => $this->uid, 'id' => $id));
|
|
|
+ if (!$this->data) {
|
|
|
+ Dever::alert('订单不存在');
|
|
|
+ }
|
|
|
+ if ($this->data['status'] == 2 || $this->data['status'] == 3) {
|
|
|
+ Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 6));
|
|
|
+
|
|
|
+ # 退款到原支付账户
|
|
|
+ return 'ok';
|
|
|
+ } else {
|
|
|
+ Dever::alert('当前订单状态不允许退货退款');
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 5));
|
|
|
+ # 部分退款退货
|
|
|
+ public function order_tui_goods()
|
|
|
+ {
|
|
|
+ $id = Dever::input('order_id');
|
|
|
+ $user_goods_id = Dever::input('user_goods_id');
|
|
|
|
|
|
- return 'ok';
|
|
|
+ $this->data = Dever::db('shop/sell_order')->find(array('uid' => $this->uid, 'id' => $id));
|
|
|
+ if (!$this->data) {
|
|
|
+ Dever::alert('订单不存在');
|
|
|
+ }
|
|
|
+ if ($this->data['status'] == 2 || $this->data['status'] == 3) {
|
|
|
+ Dever::db('shop/sell_order')->update(array('where_id' => $id, 'status' => 7));
|
|
|
+
|
|
|
+ $goods_id = explode(',', $user_goods_id);
|
|
|
+
|
|
|
+ foreach ($goods_id as $k => $v) {
|
|
|
+ Dever::db('shop/sell_order_goods')->update(array('where_id' => $v, 'status' => 3));
|
|
|
+ }
|
|
|
+
|
|
|
+ # 退款到原支付账户
|
|
|
+ return 'ok';
|
|
|
+ } else {
|
|
|
+ Dever::alert('当前订单状态不允许退货退款');
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
# 我的消息列表
|