unInform.php 19 KB

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