index.php 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359
  1. <?php
  2. use app\common\enum\DeliveryType as DeliveryTypeEnum;
  3. ?>
  4. <div class="row-content am-cf">
  5. <div class="row">
  6. <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
  7. <div class="widget am-cf">
  8. <div class="widget-head am-cf">
  9. <div class="widget-title am-cf">拼团订单列表</div>
  10. </div>
  11. <div class="widget-body am-fr">
  12. <!-- 工具栏 -->
  13. <div class="page_toolbar am-margin-bottom-xs am-cf">
  14. <form id="form-search" class="toolbar-form" action="">
  15. <input type="hidden" name="s" value="/<?= $request->pathinfo() ?>">
  16. <input type="hidden" name="active_id" value="<?= $request->param('active_id') ?>">
  17. <div class="am-u-sm-12 am-u-md-3">
  18. <div class="am-form-group">
  19. <div class="am-btn-toolbar">
  20. <div class="am-btn-group am-btn-group-xs">
  21. <?php if (checkPrivilege('apps.sharing.order.operate/export')): ?>
  22. <a class="j-export am-btn am-btn-success am-radius"
  23. href="javascript:void(0);">
  24. <i class="iconfont icon-daochu am-margin-right-xs"></i>订单导出
  25. </a>
  26. <?php endif; ?>
  27. <?php if (checkPrivilege('apps.sharing.order.operate/batchdelivery')): ?>
  28. <a class="j-export am-btn am-btn-secondary am-radius"
  29. href="<?= url('apps.sharing.order.operate/batchdelivery') ?>">
  30. <i class="iconfont icon-daoru am-margin-right-xs"></i>批量发货
  31. </a>
  32. <?php endif; ?>
  33. </div>
  34. </div>
  35. </div>
  36. </div>
  37. <div class="am-u-sm-12 am-u-md-9">
  38. <div class="am fr">
  39. <div class="am-form-group am-fl">
  40. <?php $dataType = $request->get('dataType'); ?>
  41. <select name="dataType"
  42. data-am-selected="{btnSize: 'sm', placeholder: '订单状态'}">
  43. <option value=""></option>
  44. <option value="all"
  45. <?= $dataType === 'all' ? 'selected' : '' ?>>全部
  46. </option>
  47. <option value="pay"
  48. <?= $dataType === 'pay' ? 'selected' : '' ?>>待付款
  49. </option>
  50. <option value="sharing"
  51. <?= $dataType === 'sharing' ? 'selected' : '' ?>>拼团中
  52. </option>
  53. <option value="sharing_succeed"
  54. <?= $dataType === 'sharing_succeed' ? 'selected' : '' ?>>拼团成功
  55. </option>
  56. <option value="sharing_fail"
  57. <?= $dataType === 'sharing_fail' ? 'selected' : '' ?>>拼团失败
  58. </option>
  59. <option value="delivery"
  60. <?= $dataType === 'delivery' ? 'selected' : '' ?>>待发货
  61. </option>
  62. <option value="receipt"
  63. <?= $dataType === 'receipt' ? 'selected' : '' ?>>待收货
  64. </option>
  65. <option value="complete"
  66. <?= $dataType === 'complete' ? 'selected' : '' ?>>已完成
  67. </option>
  68. <option value="cancel"
  69. <?= $dataType === 'cancel' ? 'selected' : '' ?>>已取消
  70. </option>
  71. </select>
  72. </div>
  73. <div class="am-form-group am-fl">
  74. <?php $deliveryType = $request->get('delivery_type'); ?>
  75. <select name="delivery_type"
  76. data-am-selected="{btnSize: 'sm', placeholder: '配送方式'}">
  77. <option value=""></option>
  78. <option value="-1"
  79. <?= $deliveryType === '-1' ? 'selected' : '' ?>>全部
  80. </option>
  81. <?php foreach (DeliveryTypeEnum::data() as $item): ?>
  82. <option value="<?= $item['value'] ?>"
  83. <?= $item['value'] == $deliveryType ? 'selected' : '' ?>><?= $item['name'] ?>
  84. </option>
  85. <?php endforeach; ?>
  86. </select>
  87. </div>
  88. <div class="am-form-group am-fl">
  89. <?php $extractShopId = $request->get('extract_shop_id'); ?>
  90. <select name="extract_shop_id"
  91. data-am-selected="{btnSize: 'sm', placeholder: '自提门店名称'}">
  92. <option value=""></option>
  93. <option value="-1"
  94. <?= $extractShopId === '-1' ? 'selected' : '' ?>>全部
  95. </option>
  96. <?php if (isset($shopList)): foreach ($shopList as $item): ?>
  97. <option value="<?= $item['shop_id'] ?>"
  98. <?= $item['shop_id'] == $extractShopId ? 'selected' : '' ?>><?= $item['shop_name'] ?>
  99. </option>
  100. <?php endforeach; endif; ?>
  101. </select>
  102. </div>
  103. <div class="am-form-group tpl-form-border-form am-fl">
  104. <input type="text" name="start_time"
  105. class="am-form-field"
  106. value="<?= $request->get('start_time') ?>" placeholder="请选择起始日期"
  107. data-am-datepicker>
  108. </div>
  109. <div class="am-form-group tpl-form-border-form am-fl">
  110. <input type="text" name="end_time"
  111. class="am-form-field"
  112. value="<?= $request->get('end_time') ?>" placeholder="请选择截止日期"
  113. data-am-datepicker>
  114. </div>
  115. <div class="am-form-group am-fl">
  116. <div class="am-input-group am-input-group-sm tpl-form-border-form">
  117. <input type="text" class="am-form-field" name="search"
  118. placeholder="请输入订单号/用户昵称" value="<?= $request->get('search') ?>">
  119. <div class="am-input-group-btn">
  120. <button class="am-btn am-btn-default am-icon-search"
  121. type="submit"></button>
  122. </div>
  123. </div>
  124. </div>
  125. </div>
  126. </div>
  127. </form>
  128. </div>
  129. <div class="order-list am-scrollable-horizontal am-u-sm-12 am-margin-top-xs">
  130. <table width="100%" class="am-table am-table-centered
  131. am-text-nowrap am-margin-bottom-xs">
  132. <thead>
  133. <tr>
  134. <th width="20%" class="goods-detail">商品信息</th>
  135. <th>订单类型</th>
  136. <th width="10%">单价/数量</th>
  137. <th width="10%">实付款</th>
  138. <th>买家</th>
  139. <th>支付方式</th>
  140. <th>配送方式</th>
  141. <th>交易状态</th>
  142. <th>操作</th>
  143. </tr>
  144. </thead>
  145. <tbody>
  146. <?php $colspan = 9; ?>
  147. <?php if (!$list->isEmpty()): foreach ($list as $order): ?>
  148. <tr class="order-empty">
  149. <td colspan="<?= $colspan ?>"></td>
  150. </tr>
  151. <tr>
  152. <td class="am-text-middle am-text-left" colspan="<?= $colspan ?>">
  153. <span class="am-margin-right-lg"> <?= $order['create_time'] ?></span>
  154. <span class="am-margin-right-lg">订单号:<?= $order['order_no'] ?></span>
  155. </td>
  156. </tr>
  157. <?php $i = 0;
  158. foreach ($order['goods'] as $goods): $i++; ?>
  159. <tr>
  160. <td class="goods-detail am-text-middle">
  161. <div class="goods-image">
  162. <img src="<?= $goods['image']['file_path'] ?>" alt="">
  163. </div>
  164. <div class="goods-info">
  165. <p class="goods-title"><?= $goods['goods_name'] ?></p>
  166. <p class="goods-spec am-link-muted"><?= $goods['goods_attr'] ?></p>
  167. </div>
  168. </td>
  169. <td class="am-text-middle">
  170. <?php if ($order['order_type']['value'] == 10): ?>
  171. <span class="am-badge am-badge-secondary">
  172. <?= $order['order_type']['text'] ?>
  173. </span>
  174. <?php else: ?>
  175. <span class="am-badge am-badge-success">
  176. <?= $order['order_type']['text'] ?>
  177. </span>
  178. <?php endif; ?>
  179. </td>
  180. <td class="am-text-middle">
  181. <p>¥<?= $goods['goods_price'] ?></p>
  182. <p>×<?= $goods['total_num'] ?></p>
  183. </td>
  184. <?php if ($i === 1) : $goodsCount = count($order['goods']); ?>
  185. <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
  186. <p>¥<?= $order['pay_price'] ?></p>
  187. <p class="am-link-muted">(含运费:¥<?= $order['express_price'] ?>)</p>
  188. </td>
  189. <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
  190. <p><?= $order['user']['nickName'] ?></p>
  191. <p class="am-link-muted">(用户id:<?= $order['user']['user_id'] ?>)</p>
  192. </td>
  193. <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
  194. <span class="am-badge am-badge-secondary"><?= $order['pay_type']['text'] ?></span>
  195. </td>
  196. <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
  197. <span class="am-badge am-badge-secondary"><?= $order['delivery_type']['text'] ?></span>
  198. </td>
  199. <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
  200. <p>付款状态:
  201. <span class="am-badge
  202. <?= $order['pay_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
  203. <?= $order['pay_status']['text'] ?></span>
  204. </p>
  205. <?php if (
  206. $order['pay_status']['value'] == 20
  207. && $order['order_type']['value'] == 20
  208. ): ?>
  209. <p>拼单状态:
  210. <?php if (
  211. $order['active']['status']['value'] == 0
  212. || $order['active']['status']['value'] == 10
  213. ): ?>
  214. <span class="am-badge"><?= $order['active']['status']['text'] ?></span>
  215. <?php elseif ($order['active']['status']['value'] == 20): ?>
  216. <span class="am-badge am-badge-success"><?= $order['active']['status']['text'] ?></span>
  217. <?php elseif ($order['active']['status']['value'] == 30): ?>
  218. <span class="am-badge am-badge-danger"><?= $order['active']['status']['text'] ?></span>
  219. <?php endif; ?>
  220. </p>
  221. <!--拼团失败:退款设置-->
  222. <?php if ($order['active']['status']['value'] == 30): ?>
  223. <p>退款状态:
  224. <?php if (!$order['is_refund']): ?>
  225. <span class="am-badge">待退款</span>
  226. <?php else: ?>
  227. <span class="am-badge am-badge-success">已退款</span>
  228. <?php endif; ?>
  229. </p>
  230. <?php endif; ?>
  231. <?php endif; ?>
  232. <!-- 拼单不成功不显示发货和收货状态 -->
  233. <?php if (
  234. $order['order_type']['value'] == 10
  235. || (
  236. $order['order_type']['value'] == 20
  237. && $order['active']['status']['value'] == 20
  238. )
  239. ): ?>
  240. <p>发货状态:
  241. <span class="am-badge
  242. <?= $order['delivery_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
  243. <?= $order['delivery_status']['text'] ?></span>
  244. </p>
  245. <p>收货状态:
  246. <span class="am-badge
  247. <?= $order['receipt_status']['value'] == 20 ? 'am-badge-success' : '' ?>">
  248. <?= $order['receipt_status']['text'] ?></span>
  249. </p>
  250. <?php endif; ?>
  251. <?php if ($order['order_status']['value'] == 20 || $order['order_status']['value'] == 21): ?>
  252. <p>订单状态:
  253. <span class="am-badge am-badge-warning"><?= $order['order_status']['text'] ?></span>
  254. </p>
  255. <?php endif; ?>
  256. </td>
  257. <td class="am-text-middle" rowspan="<?= $goodsCount ?>">
  258. <div class="tpl-table-black-operation">
  259. <!-- 拼团信息-->
  260. <?php if (
  261. $order['order_type']['value'] == 20
  262. && $order['pay_status']['value']
  263. && $order['active_id'] > 0
  264. ): ?>
  265. <?php if (checkPrivilege('apps.sharing.active/index')): ?>
  266. <a class="tpl-table-black-operation-default"
  267. href="<?= url('apps.sharing.active/index', ['active_id' => $order['active_id']]) ?>">
  268. 拼团信息</a>
  269. <?php endif; ?>
  270. <?php endif; ?>
  271. <!-- 订单详情-->
  272. <?php if (checkPrivilege('apps.sharing.order/detail')): ?>
  273. <a class="tpl-table-black-operation-default"
  274. href="<?= url('apps.sharing.order/detail', ['order_id' => $order['order_id']]) ?>">
  275. 订单详情</a>
  276. <?php endif; ?>
  277. <!-- 去发货-->
  278. <?php if (checkPrivilege(['apps.sharing.order/detail', 'apps.sharing.order/delivery'])): ?>
  279. <?php if (
  280. // 判断订单状态是否满足发货条件
  281. $order['pay_status']['value'] == 20
  282. && $order['order_status']['value'] != 20
  283. && $order['order_status']['value'] != 21
  284. && $order['delivery_status']['value'] == 10
  285. // 拼团订单验证拼单状态
  286. && ($order['order_type']['value'] == 20 ? $order['active']['status']['value'] == 20 : true)
  287. ): ?>
  288. <a class="tpl-table-black-operation"
  289. href="<?= url('apps.sharing.order/detail#delivery',
  290. ['order_id' => $order['order_id']]) ?>">去发货</a>
  291. <?php endif; ?>
  292. <?php endif; ?>
  293. <!-- 审核用户申请取消订单-->
  294. <?php if (checkPrivilege(['apps.sharing.order/detail', 'apps.sharing.order.operate/confirmcancel'])): ?>
  295. <?php if ($order['order_status']['value'] == 21): ?>
  296. <a class="tpl-table-black-operation-del"
  297. href="<?= url('apps.sharing.order/detail#cancel',
  298. ['order_id' => $order['order_id']]) ?>">去审核</a>
  299. <?php endif; ?>
  300. <?php endif; ?>
  301. <!-- 拼团失败手动退款-->
  302. <?php if (checkPrivilege('apps.sharing.order.operate/refund')): ?>
  303. <?php if (
  304. $order['order_type']['value'] == 20
  305. && $order['pay_status']['value'] == 20
  306. && $order['active']['status']['value'] == 30
  307. && $order['is_refund'] == 0
  308. ): ?>
  309. <a class="tpl-table-black-operation-del"
  310. href="<?= url('apps.sharing.order/detail#refund',
  311. ['order_id' => $order['order_id']]) ?>">去退款</a>
  312. <?php endif; ?>
  313. <?php endif; ?>
  314. </div>
  315. </td>
  316. <?php endif; ?>
  317. </tr>
  318. <?php endforeach; ?>
  319. <?php endforeach; else: ?>
  320. <tr>
  321. <td colspan="<?= $colspan ?>" class="am-text-center">暂无记录</td>
  322. </tr>
  323. <?php endif; ?>
  324. </tbody>
  325. </table>
  326. </div>
  327. <div class="am-u-lg-12 am-cf">
  328. <div class="am-fr"><?= $list->render() ?> </div>
  329. <div class="am-fr pagination-total am-margin-right">
  330. <div class="am-vertical-align-middle">总记录:<?= $list->total() ?></div>
  331. </div>
  332. </div>
  333. </div>
  334. </div>
  335. </div>
  336. </div>
  337. </div>
  338. <script>
  339. $(function () {
  340. /**
  341. * 订单导出
  342. */
  343. $('.j-export').click(function () {
  344. var data = {};
  345. var formData = $('#form-search').serializeArray();
  346. $.each(formData, function () {
  347. this.name !== 's' && (data[this.name] = this.value);
  348. });
  349. window.location = "<?= url('apps.sharing.order.operate/export') ?>" + '&' + $.urlEncode(data);
  350. });
  351. });
  352. </script>