list.php 18 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389
  1. <?php
  2. use yii\widgets\LinkPager;
  3. ?>
  4. <style type="text/css">
  5. .btn-gray {
  6. cursor: default;
  7. }
  8. </style>
  9. <?php
  10. use backend\widgets\TabWidget;
  11. echo TabWidget::widget(['list' => $this->context->menuList, 'currentMenu' => $this->context->id]);
  12. ?>
  13. <div class="panel panel-default">
  14. <?php
  15. use backend\widgets\SubTabWidget;
  16. echo SubTabWidget::widget(['list' => $this->context->subMenuList, 'currentMenu' => $this->context->action->id]);
  17. ?>
  18. <div class="panel-body">
  19. <div id="example-2_wrapper"
  20. class="dataTables_wrapper form-inline dt-bootstrap no-footer">
  21. <div class="row">
  22. <form action="" method="GET">
  23. <div class="col-xs-6" style="width:90%;">
  24. <div class="dataTables_length">
  25. <label><input type="search" name="content" value="<?= $content ?>" class="form-control" placeholder="订单号 / 订花人手机号"></label>
  26. <input class="btn btn-secondary btn-single" type="submit" name="" value="搜索"/>
  27. </div>
  28. </div>
  29. </form>
  30. </div>
  31. <div class="table-responsive">
  32. <table class="table table-bordered table-striped table-hover table-condensed">
  33. <thead>
  34. <tr class="active">
  35. <th class="no-sorting hidden-xs"><input type="checkbox"></th>
  36. <th>单号</th>
  37. <th>订花人</th>
  38. <th class="hidden-xs">收花人</th>
  39. <th>总价</th>
  40. <th class="hidden-xs">实付款</th>
  41. <th class="hidden-xs">送达时间</th>
  42. <th class="hidden-xs">状态</th>
  43. <th class="hidden-xs">编号</th>
  44. <th>类型</th>
  45. <th>操作</th>
  46. </tr>
  47. </thead>
  48. <tbody class="middle-align">
  49. <?php foreach ($models as $key => $val) { ?>
  50. <tr>
  51. <td class="hidden-xs"><input type="checkbox"></td>
  52. <td>
  53. <a class="add-under-line" href="/order/detail?id=<?= $val['id'] ?>"><?= $val['id'] ?></a>
  54. </td>
  55. <td><?= $val['bookName'] ?> <?= $val['bookMobile'] ?></td>
  56. <td class="hidden-xs receive-user">
  57. <?= $val['receiveUserName'] ?> <?= $val['receiveMobile'] ?>
  58. </td>
  59. <td><?= $val['prePrice'] ?></td>
  60. <td class="hidden-xs">
  61. <span><?= $val['actPrice'] ?><?php if ($val['sendCost'] > 0) {
  62. echo '(运费' . $val['sendCost'] . ')';
  63. } ?></span>
  64. <?php if ($val['payStatus'] == 0 && empty($val['payCode'])) { ?>
  65. <?php if ($val['modPriceStatus'] == 0) { ?>
  66. <input type="text" name="modifyPrice" pre_price="<?= $val['actPrice'] ?>" data-id="<?= $val['id'] ?>" style="width:45px;display:none;border-radius:3px;border:1px solid #ccc;" value="<?= $val['sendNum'] ?>"/>
  67. <a href="javascript:void(0)" name="modifyPrice" pre_price="<?= $val['actPrice'] ?>" style="color:#68b828;cursor:pointer;text-decoration:none;"
  68. <i="" class="fa-pencil"></a>
  69. <?php } ?>
  70. <?php } ?>
  71. </td>
  72. <td class="hidden-xs"><?php if (!empty($val['reachTime'])) {
  73. echo date("m-d", strtotime($val['reachTime'])) . ' ' . $reachPeriodName[$val['reachPeriod']];
  74. } ?></td>
  75. <td class="hidden-xs"><?php echo $payStatusName[$val['payStatus']]; ?></td>
  76. <td class="hidden-xs">
  77. <span><?= $val['sendNum'] ?></span>
  78. <!-- <input type="text" name="modifySendNum" data-id="--><? //= $val['id'] ?><!--" style="width:30px;display:none;border-radius:3px;border:1px solid #ccc;" value="--><? //= $val['sendNum'] ?><!--" />-->
  79. <!--<a href="javascript:void(0)" name="modifySendNum" pre_send_num="<?= $val['sendNum'] ?>" style="color:#68b828;cursor:pointer;text-decoration:none;" <i="" class="fa-pencil"></a>-->
  80. </td>
  81. <td>
  82. <span name="setOrderStyle_<?= $val['id'] ?>">
  83. <?php
  84. if (!empty($val['usageId']) && !empty($val['categoryId'])) {
  85. $usageId = $val['usageId'];
  86. $categoryId = $val['categoryId'];
  87. $categoryName = isset($categoryList[$categoryId]) ? $categoryList[$categoryId]['name'] : '';
  88. $usageName = isset($usageList[$usageId]) ? $usageList[$usageId]['name'] : '';
  89. echo $usageName;
  90. } else { ?>
  91. <?php if ($val['payStatus'] == 1) { ?>
  92. <a href="javascript:void(0);" onclick="setOrderStyleToShow('<?= $val['id'] ?>')" style="color:#68b828;"><i class="fa-wrench"></i></a>
  93. <?php } ?>
  94. <?php } ?>
  95. </span>
  96. </td>
  97. <td>
  98. <?php
  99. if ($val['receiveUserName'] != '' && $val['receiveMobile'] != ''){
  100. ?><!-- 有收花人信息 -->
  101. <?php if ($val['payStatus'] == 0) { ?> <!-- 未付款 -->
  102. <?php if ($val['printStatus'] == 0) { ?>
  103. <a href="javascript:void(0)" name="printOrder" pay-status="no" data-msg="打印" id="printOrder<?= $val['id'] ?>" order-id="<?= $val['id'] ?>" class="btn btn-secondary btn-sm btn-icon icon-left hidden-xs">打印</a>
  104. <?php } else { ?>
  105. <a href="javascript:void(0)" name="reprintOrder" pay-status="no" data-msg="打印" id="reprintOrder<?= $val['id'] ?>" order-id="<?= $val['id'] ?>" class="btn btn-turquoise btn-sm btn-icon icon-left hidden-xs">重打</a>
  106. <?php } ?>
  107. <?php if ($val['sendStatus'] == 0) { ?>
  108. <a href="javascript:void(0)" name="dealOrder" pay-status="no" data-msg="通知客户货已送达" id="dealOrder-<?= $val['id'] ?>" data-url="/order/update-pay-status?id=<?= $val['id'] ?>&status=2" class="btn btn-secondary btn-sm btn-icon icon-left">通知</a>
  109. <?php } else if ($val['sendStatus'] == 1) { ?>
  110. <a href="javascript:void(0)" class="btn btn-secondary btn-sm btn-icon icon-left">送货中</a>
  111. <?php } else if ($val['sendStatus'] == 2) { ?>
  112. <a href="javascript:void(0)" class="btn btn-gray btn-sm btn-icon icon-left">已通知</a>
  113. <?php } ?>
  114. <?php } else if ($val['payStatus'] == 1) { ?><!-- 已经付款 -->
  115. <?php if ($val['printStatus'] == 0) { ?>
  116. <a href="javascript:void(0)" name="printOrder" id="printOrder<?= $val['id'] ?>" order-id="<?= $val['id'] ?>" class="btn btn-secondary btn-sm btn-icon icon-left hidden-xs">打印</a>
  117. <?php } else { ?>
  118. <a href="javascript:void(0)" name="reprintOrder" id="reprintOrder<?= $val['id'] ?>" order-id="<?= $val['id'] ?>" class="btn btn-turquoise btn-sm btn-icon icon-left hidden-xs">重打</a>
  119. <?php } ?>
  120. <?php if ($val['sendStatus'] == 0) { ?>
  121. <a href="javascript:void(0)" name="dealOrder" data-msg="通知客户货已送达" id="dealOrder-<?= $val['id'] ?>" data-url="/order/update-pay-status?id=<?= $val['id'] ?>&status=2" class="btn btn-secondary btn-sm btn-icon icon-left">通知</a>
  122. <?php } else if ($val['sendStatus'] == 1) { ?>
  123. <a href="javascript:void(0)" class="btn btn-secondary btn-sm btn-icon icon-left">送货中</a>
  124. <?php } else if ($val['sendStatus'] == 2) { ?>
  125. <a href="javascript:void(0)" class="btn btn-gray btn-sm btn-icon icon-left">已通知</a>
  126. <?php } ?>
  127. <?php } else { ?>
  128. <button class="btn btn-danger">出现错误状态:<?= $val['payStatus'] ?></button>
  129. <?php } ?>
  130. <?php }else{ ?><!-- 没有收花人信息 -->
  131. <a href="javascript:void(0)" class="btn btn-gray btn-sm btn-icon icon-left hidden-xs">打印</a>
  132. <?php
  133. }
  134. ?>
  135. </td>
  136. </tr>
  137. <?php } ?>
  138. </tbody>
  139. </table>
  140. </div>
  141. <div class="row">
  142. <div>
  143. <!--
  144. <div style="display:inline-block;margin-left:15px;">
  145. <label><select name="example-1_length"
  146. aria-controls="example-1" class="form-control">
  147. <option value="0">批量操作</option>
  148. <option value="1">批量下架</option>
  149. <option value="2">批量删除</option>
  150. </select>
  151. </label>
  152. <input class="btn btn-secondary btn-single" type="submit" name="" value="确认" />
  153. </div>
  154. -->
  155. <div class="dataTables_paginate paging_simple_numbers" style="float:right;padding-top:0px;margin-right:15px;">
  156. <?= LinkPager::widget(['pagination' => $pages]); ?>
  157. </div>
  158. </div>
  159. </div>
  160. </div>
  161. </div>
  162. </div>
  163. <!-- footer -->
  164. <?php
  165. use backend\widgets\FooterWidget;
  166. ?>
  167. <?= FooterWidget::widget() ?>
  168. <!-- footer -->
  169. <script>
  170. function updatePrintStatus(obj, orderId) {
  171. $.ajax({
  172. type: "GET",
  173. url: '/order/update-print-status?id=' + orderId + '&status=1',
  174. async: false,
  175. dataType: 'json',
  176. success: function (data) {
  177. if (data.code == 'A0001') {
  178. obj.removeClass('btn-secondary').addClass('btn-turquoise').html('重打');
  179. window.open('/order/print?id=' + orderId);
  180. } else {
  181. xhPopMsg(data.msg);
  182. }
  183. }
  184. });
  185. }
  186. $("a[name=printOrder]").click(function () {
  187. var obj = $(this);
  188. var orderId = $(this).attr('order-id');
  189. var payStatus = $(this).attr('pay-status');
  190. if (payStatus == 'no') {
  191. var msg = $(this).attr('data-msg');
  192. $("#confirmMention .modal-body").html('此订单未付款,确认' + msg + '?');
  193. $('#confirmMention').modal('show', {backdrop: 'fade'}).css({
  194. 'margin-top': function () {
  195. var modalHeight = jQuery("#confirmMention").find('.modal-dialog').height();
  196. return ($(window).height() / 2 - (modalHeight / 2));
  197. }
  198. });
  199. $("button[name=confirmOk]").click(function () {
  200. $('#confirmMention').modal('hide');
  201. updatePrintStatus(obj, orderId);
  202. });
  203. } else {
  204. updatePrintStatus(obj, orderId);
  205. }
  206. });
  207. $("a[name=reprintOrder]").click(function () {
  208. var orderId = $(this).attr('order-id');
  209. var payStatus = $(this).attr('pay-status');
  210. if (payStatus == 'no') {
  211. var msg = $(this).attr('data-msg');
  212. $("#confirmMention .modal-body").html('此订单未付款,确认' + msg + '?');
  213. $('#confirmMention').modal('show', {backdrop: 'fade'}).css({
  214. 'margin-top': function () {
  215. var modalHeight = jQuery("#confirmMention").find('.modal-dialog').height();
  216. return ($(window).height() / 2 - (modalHeight / 2));
  217. }
  218. });
  219. $("button[name=confirmOk]").click(function () {
  220. $('#confirmMention').modal('hide');
  221. window.open('/order/print?id=' + orderId);
  222. });
  223. } else {
  224. window.open('/order/print?id=' + orderId);
  225. }
  226. });
  227. </script>
  228. <!-- modal 确认提醒框 -->
  229. <div class="modal fade" id="confirmMention">
  230. <div class="modal-dialog" style="height:300px;">
  231. <div class="modal-content">
  232. <div class="modal-header">
  233. <button type="button" class="close" data-dismiss="modal" aria-hidden="true">&times;</button>
  234. <h4 class="modal-title">消息提示</h4>
  235. </div>
  236. <input type="hidden" name="requestUrl" value=""/> <input type="hidden" name="id" value=""/>
  237. <div class="modal-body">
  238. 确认<span></span>?
  239. </div>
  240. <div class="modal-footer">
  241. <button type="button" class="btn btn-info" name="confirmOk">确认</button>
  242. <button type="button" class="btn btn-white" data-dismiss="modal">取消</button>
  243. </div>
  244. </div>
  245. </div>
  246. </div>
  247. <script>
  248. //确认提醒操作
  249. $(function () {
  250. jQuery("a[name=dealOrder]").click(function () {
  251. var url = $(this).attr('data-url');
  252. var classId = $(this).attr('id');
  253. var msg = $(this).attr('data-msg');
  254. var payStatus = $(this).attr('pay-status');
  255. if (payStatus == 'no') {
  256. $("#confirmMention .modal-body").html('此订单未付款,确认' + msg + '?');
  257. }
  258. $("#confirmMention .modal-body span").text(msg);
  259. $("#confirmMention input[name=requestUrl]").val(url);
  260. $("#confirmMention input[name=id]").val(classId);
  261. jQuery('#confirmMention').modal('show', {backdrop: 'fade'}).css({
  262. 'margin-top': function () {
  263. var modalHeight = jQuery("#confirmMention").find('.modal-dialog').height();
  264. return ($(window).height() / 2 - (modalHeight / 2));
  265. }
  266. });
  267. });
  268. //点击确认操作
  269. jQuery("button[name=confirmOk]").click(function () {
  270. var url = $("#confirmMention input[name=requestUrl]").val();
  271. var classId = $("#confirmMention input[name=id]").val();
  272. $.ajax({
  273. type: "GET",
  274. url: url,
  275. async: false,
  276. dataType: 'json',
  277. success: function (data) {
  278. if (data.code == 'A0001') {
  279. $('#confirmMention').modal('hide');
  280. //window.location.reload();
  281. $('#' + classId).removeClass('btn-secondary').addClass('btn-gray').html('已通知');
  282. } else {
  283. xhPopMsg(data.msg, 1300);
  284. }
  285. }
  286. });
  287. });
  288. });
  289. //修改配送编号
  290. $("a[name=modifySendNum]").click(function () {
  291. var pre_send_num = $(this).attr('pre_send_num');
  292. $(this).css("display", "none").siblings('span').css('display', 'none').siblings('input').css('display', 'block').focus().val(pre_send_num);
  293. });
  294. $("input[name=modifySendNum]").blur(function () {
  295. var num = $(this).val();
  296. var that = $(this);
  297. if (num.length > 0) {
  298. var id = $(this).attr('data-id');
  299. $.ajax({
  300. type: "GET",
  301. url: '/order/modify-send-num?id=' + id + '&num=' + num,
  302. async: false,
  303. dataType: 'json',
  304. success: function (data) {
  305. if (data.code == 'A0001') {
  306. that.css('display', 'none');
  307. that.siblings('a').css("display", "inline-block").attr("pre_send_num", num);
  308. that.siblings('span').css("display", "inline-block").html(num);
  309. }
  310. xhPopMsg(data.msg);
  311. }
  312. });
  313. }
  314. });
  315. //修改价格
  316. $("a[name=modifyPrice]").click(function () {
  317. var pre_price = $(this).attr('pre_price');
  318. $(this).css("display", "none").siblings('span').css('display', 'none').siblings('input').css('display', 'block').focus().val(pre_price);
  319. });
  320. $("input[name=modifyPrice]").blur(function () {
  321. var that = $(this);
  322. var newPrice = $(this).val();
  323. var pre_price = $(this).attr('pre_price');
  324. if (isNaN(newPrice)) {
  325. xhPopMsg('价格填写有误', 1300);
  326. that.focus().val(pre_price);
  327. return;
  328. }
  329. if (newPrice <= 0) {
  330. xhPopMsg('价格不能小于0', 1300);
  331. that.focus().val(pre_price);
  332. return;
  333. }
  334. if (newPrice.indexOf('.') > 0) {
  335. if (newPrice.toString().split(".")[1].length > 2) {
  336. xhPopMsg('价格填写有误', 1300);
  337. that.focus().val(pre_price);
  338. return;
  339. }
  340. }
  341. if (newPrice.length > 0) {
  342. var id = $(this).attr('data-id');
  343. $.ajax({
  344. type: "GET",
  345. url: '/order/modify-price?id=' + id + '&actPrice=' + newPrice,
  346. async: false,
  347. dataType: 'json',
  348. success: function (data) {
  349. xhPopMsg(data.msg);
  350. if (data.code == 'A0001') {
  351. that.css('display', 'none').attr("pre_price", newPrice);
  352. that.siblings('a').css("display", "inline-block").attr("pre_price", newPrice);
  353. that.siblings('span').css("display", "inline-block").html(newPrice);
  354. } else {
  355. that.css('display', 'none').attr("pre_price", pre_price);
  356. that.siblings('a').css("display", "inline-block").attr("pre_price", pre_price);
  357. that.siblings('span').css("display", "inline-block").html(pre_price);
  358. that.focus().val(pre_price);
  359. }
  360. }
  361. });
  362. }
  363. });
  364. </script>