info.php 20 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557
  1. <script type="text/javascript" src="http://api.map.baidu.com/api?v=2.0&ak=B349f0b32ef6e78b2e678f45cb9fddaf"></script>
  2. <link href="//cdn.bootcss.com/bootstrap/4.0.0-alpha.5/css/bootstrap.min.css" rel="stylesheet">
  3. <script src="<?php echo Yii::app()->request->baseUrl; ?>/js/o2o/jq-signature.min.js"></script>
  4. <link rel="stylesheet" href="<?php echo Yii::app()->request->baseUrl; ?>/css">
  5. <div>
  6. <div id="header">
  7. <div class="am-g">
  8. <div class="am-u-sm-12">
  9. <div class="layoutbox">
  10. 订单详情
  11. </div>
  12. </div>
  13. </div>
  14. </div>
  15. <!-- 订单详情 -->
  16. <div id="info">
  17. <div class="am-popup-bd" id="info_content" style="display: none;">
  18. <div class="am-g">
  19. <div class="am-u-sm-4">预约时间</div>
  20. <div class="am-u-sm-8">{{info.booking_time_str}}</div>
  21. </div>
  22. <div class="am-g">
  23. <div class="am-u-sm-4">客户姓名</div>
  24. <div class="am-u-sm-8">{{info.address.name}}</div>
  25. </div>
  26. <div class="am-g">
  27. <div class="am-u-sm-4">地址</div>
  28. <div class="am-u-sm-8">{{info.address.city}}&nbsp;{{info.address.area}}&nbsp;{{info.address.poi.name}}&nbsp;{{info.address.detail}}</div>
  29. </div>
  30. <div class="am-g">
  31. <div class="am-u-sm-4">客户电话</div>
  32. <div class="am-u-sm-8"><a href="tel:{{info.address.mobile}}">{{info.address.mobile}}</a></div>
  33. </div>
  34. <div class="am-g">
  35. <div class="am-u-sm-4">订单状态</div>
  36. <div class="am-u-sm-8">{{info.status_str}}</div>
  37. </div>
  38. <br>
  39. <div class="am-g">
  40. <div class="am-u-sm-6">
  41. <button class="am-btn am-btn-primary" style="width: 100%;" id="showMap">显示地图</button>
  42. </div>
  43. <div class="am-u-sm-6">
  44. <button class="am-btn am-btn-default" style="width: 100%;" id="hideMap">隐藏地图</button>
  45. </div>
  46. </div>
  47. <div class="am-g">
  48. <div class="am-u-sm-12">
  49. <div id="map_box" style="display: none;">
  50. <div id="map_container" style="margin-top: 10px; width: 100%;"></div>
  51. </div>
  52. </div>
  53. </div>
  54. <br>
  55. <div class="am-g">
  56. <div class="am-u-sm-4">产品</div>
  57. <div class="am-u-sm-12">
  58. <ul class="am-list am-list-static am-list-border">
  59. <li v-for="product in info.products">
  60. 名称:&nbsp;<span id="formProductName">{{info.products[0].product.name}}</span><br>
  61. 价格:&nbsp;{{info.products[0].product.price}}
  62. </li>
  63. </ul>
  64. </div>
  65. </div>
  66. <div class="am-g" v-if="info.append_orders.length > 0">
  67. <div class="am-u-sm-4">追加订单</div>
  68. <div class="am-u-sm-12">
  69. <ul class="am-list am-list-static am-list-border">
  70. <li v-for="append in info.append_orders">
  71. <ul class="am-list am-list-static am-list-border">
  72. <li v-for="product in append.products">
  73. 服务:&nbsp;{{product.name}}<br>
  74. 价格:&nbsp;{{product.price}}
  75. </li>
  76. </ul>
  77. </li>
  78. </ul>
  79. </div>
  80. </div>
  81. <div class="am-g am-hide" id="confirm_container">
  82. <div class="am-u-sm-12">
  83. <button class="am-btn am-btn-block am-btn-primary" id="confirm_set_out">确认订单</button>
  84. </div>
  85. </div>
  86. <div class="am-g am-hide" id="setout_container">
  87. <div class="am-u-sm-12">
  88. <button class="am-btn am-btn-block am-btn-primary" id="confirm_set_out">确认出发</button>
  89. </div>
  90. </div>
  91. <div class="am-g am-hide" id="come_container">
  92. <div class="am-u-sm-12">
  93. <button class="am-btn am-btn-block am-btn-primary" id="confirm_come">确认上门</button>
  94. </div>
  95. </div>
  96. <div class="am-g am-hide" id="has_come_container">
  97. <div class="am-u-sm-12">
  98. <button class="am-btn am-btn-block am-btn-primary">已上门</button>
  99. </div>
  100. </div>
  101. <div class="am-g am-hide" id="has_come_success">
  102. <div class="am-u-sm-12">
  103. <button class="am-btn am-btn-block am-btn-primary am-disabled">已完成</button>
  104. </div>
  105. </div>
  106. </div>
  107. </div>
  108. </div>
  109. <!--手写板-->
  110. <div id="pics"
  111. style="position: fixed;width: 100%;background: #fff;top:0;display: none;text-align: center;padding-bottom: 10px;">
  112. <div class="">
  113. <div class="">
  114. <div class="js-signature"></div>
  115. </div>
  116. <p style="margin:0;border-top: 1px solid rgba(0,0,0,0.3);padding-top: 4px;">
  117. <button id="returnBtn" class="btn btn-default">返回</button>
  118. <button id="clearBtn" class="btn btn-default" onclick="clearCanvas();">清除</button>
  119. &nbsp;
  120. <button id="saveBtn" class="btn btn-default" onclick="saveSignature();" disabled>确认财产无误</button>
  121. </p>
  122. </div>
  123. </div>
  124. <div style="clear: both"></div>
  125. <!--表单-->
  126. <div id="orderForm"
  127. class="am-hide"
  128. style="position: fixed;top: 0;width: 100%;background: rgba(255,255,255,1);color:rgb(0,0,0);">
  129. <h1 style="text-align: center;margin-top: 1rem" id="formH1">民宿保洁检查表</h1>
  130. <form action="" id="orderFormTitle" class="form-ul">
  131. <div class="form-ul" style="position: fixed;5rem;">
  132. <!--设备检查-->
  133. <div id="orderForm1" class="am-hide">
  134. <h3 style="text-align: left">设备检查</h3>
  135. <input type="checkbox" value="电视机">电视机有遥控器、可开启。<br/>
  136. <input type="checkbox" value="空调">空调有遥控器、可开启。<br/>
  137. <input type="checkbox" value="冰箱">冰箱运行中。<br/>
  138. <input type="checkbox" value="Wifi">Wifi可连接。<br/>
  139. </div>
  140. <!--卧室客厅-->
  141. <div id="orderForm2" class="am-hide">
  142. <h3 style="text-align: left">卧室客厅</h3>
  143. <input type="checkbox" value="四件套">四件套,已换新,无污无毛发。<br/>
  144. <input type="checkbox" value="床底">床底,床沿触手可及处,无异物。<br/>
  145. <input type="checkbox" value="床头柜"><span>床头柜,抽屉内无前客残留物,台面干净、无灰尘污迹。</span><br/>
  146. <input type="checkbox" value="地面">地面,扫过一遍,无明显毛发、灰尘、污迹。<br/>
  147. <input type="checkbox" value="茶几、写字台">茶几、写字台,台面干净、无灰尘污迹。<br/>
  148. </div>
  149. <!--洗手间-->
  150. <div id="orderForm3" class="am-hide">
  151. <h3 style="text-align: left">洗手间</h3>
  152. <input type="checkbox" value="马桶">马桶洗刷一遍,清洁无渍,无毛发,马桶盖翻开。<br/>
  153. <input type="checkbox" value="台盆">台盆,台面台盆整洁,已擦干,无渍无毛发。<br/>
  154. <input type="checkbox" value="浴缸、淋浴房">浴缸、淋浴房,已擦干,无渍无毛发。<br/>
  155. <input type="checkbox" value="地面">地面拖过一遍、无明显毛发、灰尘、污迹。<br/>
  156. </div>
  157. <!--厨房-->
  158. <div id="orderForm4" class="am-hide">
  159. <h3 style="text-align: left">厨房</h3>
  160. <input type="checkbox" value="冰箱">厨房无前客残留物,内无食物残留污迹。<br/>
  161. <input type="checkbox" value="微波炉">微波炉内壁托盘无明显食物残留污迹。<br/>
  162. <input type="checkbox" value="灶台、厨具">灶台、厨具灶台清洁无油渍,使用过的厨具清洗擦拭收纳。<br/>
  163. <input type="checkbox" value="餐桌">餐桌擦拭一遍,无污迹油渍。。<br/>
  164. <input type="checkbox" value="水斗">水斗无厨余残存痕迹。<br/>
  165. <input type="checkbox" value="地面">地面扫过一遍,无明显灰尘、污迹。<br/>
  166. </div>
  167. <!--最后检查-->
  168. <div id="orderForm5" class="am-hide form-group">
  169. <h3 style="text-align: left">最后检查</h3>
  170. <div class="col-xs-12 col-sm-12 col-md-12">
  171. <input type="checkbox" value="窗户">窗户闭合关实。<br/>
  172. <input type="checkbox" value="电器">电器除冰箱、wifi外,其它家电关闭状态。<br/>
  173. </div>
  174. <h4>物料</h4>
  175. <div class="" style="display: block">
  176. <span class="col-xs-8 col-md-8">卧室、客厅,有纸巾摆放包数。</span>
  177. <select name="" class="" id="">
  178. <option value="0">0</option>
  179. <option value="0-5">0-5</option>
  180. <option value="5-10">5-10</option>
  181. <option value="10-20">10-20</option>
  182. </select>
  183. </div>
  184. <div class="col-lg-12">
  185. <span class="col-xs-8 col-md-8">厕所,有卷纸摆放包数。</span>
  186. <br>
  187. <select name="" class="" id="">
  188. <option value="0">0</option>
  189. <option value="0-5">0-5</option>
  190. <option value="5-10">5-10</option>
  191. <option value="10-20">10-20</option>
  192. </select>
  193. </div>
  194. <div class="col-xs-12 col-sm-12 col-md-12">
  195. <input type="checkbox"> 洗发水、沐浴露预估存于30%以上。
  196. </div>
  197. </div>
  198. </div>
  199. <div style="text-align: center;position:fixed;bottom:1rem;margin-top: 1rem;" class="col-xs-12 col-sm-12 col-md-12">
  200. <a class="btn btn-danger" id="formNO">取消</a>
  201. &nbsp;&nbsp;
  202. <a class="btn btn-success" id="formYes">确认</a>
  203. </div>
  204. </form>
  205. </div>
  206. <script type="text/javascript">
  207. /*设置全局变量*/
  208. var url;
  209. var index = 0;
  210. /*表单js*/
  211. $(function () {
  212. /*取消*/
  213. $('#formNO').on('click', function () {
  214. if (index == 0) {
  215. $('#orderForm').addClass('am-hide');
  216. $('#orderForm1').addClass('am-hide');
  217. return false;
  218. }
  219. if (index == 1) {
  220. $('#orderForm1').removeClass('am-hide');
  221. $('#orderForm2').addClass('am-hide');
  222. index = 0;
  223. return false;
  224. }
  225. if (index == 2) {
  226. $('#orderForm2').removeClass('am-hide');
  227. $('#orderForm3').addClass('am-hide');
  228. index = 1;
  229. return false;
  230. }
  231. if (index == 3) {
  232. $('#orderForm3').removeClass('am-hide');
  233. $('#orderForm4').addClass('am-hide');
  234. index = 2;
  235. return false;
  236. }
  237. if (index == 4) {
  238. $('#orderForm4').removeClass('am-hide');
  239. $('#orderForm5').addClass('am-hide');
  240. index = 3;
  241. return false;
  242. }
  243. });
  244. /*确认*/
  245. $('#formYes').on('click', function () {
  246. if (index == 0) {
  247. $('#orderForm1').addClass('am-hide');
  248. $('#orderForm2').removeClass('am-hide');
  249. index = 1;
  250. return false;
  251. }
  252. if (index == 1) {
  253. $('#orderForm2').addClass('am-hide');
  254. $('#orderForm3').removeClass('am-hide');
  255. index = 2;
  256. return false;
  257. }
  258. if (index == 2) {
  259. $('#orderForm3').addClass('am-hide');
  260. $('#orderForm4').removeClass('am-hide');
  261. index = 3;
  262. return false;
  263. }
  264. if (index == 3) {
  265. $('#orderForm4').addClass('am-hide');
  266. $('#orderForm5').removeClass('am-hide');
  267. index = 4;
  268. return false;
  269. }
  270. if (index == 4) {
  271. $('#orderForm5').addClass('am-hide');
  272. //隐藏表单
  273. $('#orderForm').addClass('am-hide');
  274. /*调用手写板*/
  275. $('#has_come_container').addClass('am-hide');
  276. $('#has_come_success').removeClass('am-hide');
  277. $('#pics').css('display', 'block');
  278. $('.js-signature').eq(0).on('jq.signature.changed', function () {
  279. $('#saveBtn').attr('disabled', false);
  280. });
  281. }
  282. });
  283. /*返回*/
  284. $('#returnBtn').on('click', function () {
  285. index = 0;
  286. $('#pics').css('display', 'none');
  287. $('#has_come_container').removeClass('am-hide');
  288. $('#has_come_success').addClass('am-hide');
  289. })
  290. });
  291. /*form样式调整*/
  292. $(function () {
  293. /*设置ul与li样式*/
  294. $('ul.form-ul').css("margin", '0').css('padding', '0');
  295. $('ul.form-ul').children('li').css("list-style", 'none');
  296. /*设置ul的宽度*/
  297. $('ul.form-ul').children('li').width(($(window).width()));
  298. /*设置ul的高度 orderFormOne*/
  299. $('ul.form-ul').height($('#orderForm1').height());
  300. /*设置li的宽度*/
  301. // $('ul.form-ul').children('li').width($(window).width());
  302. /*设置表单的margin-top*/
  303. var formMargin = ((($(window).height()) - ($('#orderFormTitle').height())) / 6) - (($('#formH1').height()) * 3);
  304. $('#orderFormTitle').css('margin-top', formMargin);
  305. $('#orderForm').height($(window).height());
  306. /*设置body的外边距为0*/
  307. $('body').css('margin', '0');
  308. });
  309. /*手写板js*/
  310. $(document).on('ready', function () {
  311. if ($('.js-signature').length) {
  312. $('.js-signature').jqSignature();
  313. }
  314. });
  315. $('.js-signature').eq(0).on('jq.signature.changed', function () {
  316. $('#saveBtn').attr('disabled', false);
  317. });
  318. $('#pics').height($(window).height());//设置底层div高度
  319. $("canvas").width($(window).width());//设置手写板宽度
  320. $("canvas").height($(window).height() - ($('#saveBtn').height()));//设置手写板高度
  321. document.title = '我的订单-详情';
  322. var order = <?php echo json_encode($order); ?>;
  323. var user = <?php echo json_encode($user); ?>;
  324. var showMap = false;
  325. var w_height = $(window).height();
  326. var map_height = w_height * 0.6;
  327. $('#map_container').css({height: map_height + 'px'});
  328. var v_order = new Vue({
  329. el: '#info',
  330. data: {
  331. info: []
  332. }
  333. });
  334. $(function () {
  335. getOrderInfo(order, user);
  336. // 显示地图
  337. $('#showMap').click(function () {
  338. address = v_order.info.address;
  339. position = address.position;
  340. if (!position) {
  341. $.valert('定位信息未记录');
  342. return false;
  343. }
  344. $('#map_box').show();
  345. map = new BMap.Map('map_container');
  346. point = new BMap.Point(position[0], position[1]);
  347. marker = new BMap.Marker(point);
  348. map.addOverlay(marker);
  349. map.centerAndZoom(point, 15);
  350. windowOpts = {
  351. width: 200,
  352. height: 100,
  353. title: address.area
  354. }
  355. infoWindow = new BMap.InfoWindow(address.detail, windowOpts);
  356. marker.addEventListener("click", function () {
  357. map.openInfoWindow(infoWindow, point);
  358. });
  359. });
  360. // 隐藏地图
  361. $('#hideMap').click(function () {
  362. $('#map_box').hide();
  363. });
  364. //确认订单
  365. $('#confirm_container').click(function () {
  366. $.vloading('open');
  367. $.post(
  368. '/index.php?r=o2o/myOrder/techConfirmOrder',
  369. {
  370. order: order,
  371. user: user
  372. },
  373. function (res) {
  374. $.vloading('close');
  375. var data = $.parseJSON(res);
  376. if (data.success) {
  377. $('#confirm_container').addClass('am-hide');
  378. $('#setout_container').removeClass('am-hide');
  379. $('#come_container').addClass('am-hide');
  380. $('#has_come_container').addClass('am-hide');
  381. } else {
  382. $.valert(data.msg);
  383. }
  384. }
  385. );
  386. });
  387. // 确认出发
  388. $('#setout_container').click(function () {
  389. $.vloading('open');
  390. $.post(
  391. '/index.php?r=o2o/myOrder/techSetout',
  392. {
  393. order: order,
  394. user: user
  395. },
  396. function (res) {
  397. $.vloading('close');
  398. var data = $.parseJSON(res);
  399. if (data.success) {
  400. $('#setout_container').addClass('am-hide');
  401. $('#come_container').removeClass('am-hide');
  402. $('#has_come_container').addClass('am-hide');
  403. } else {
  404. $.valert(data.msg);
  405. }
  406. }
  407. );
  408. });
  409. // 确认上门
  410. $('#confirm_come').click(function () {
  411. $.vloading('open');
  412. $.post(
  413. '/index.php?r=o2o/myOrder/techCome',
  414. {
  415. order: order,
  416. user: user
  417. },
  418. function (res) {
  419. $.vloading('close');
  420. var data = $.parseJSON(res);
  421. if (data.success) {
  422. $('#setout_container').addClass('am-hide');
  423. $('#come_container').addClass('am-hide');
  424. $('#has_come_container').removeClass('am-hide');
  425. $('#has_come_success').addClass('am-hide');
  426. } else {
  427. $.valert(data.msg);
  428. }
  429. }
  430. );
  431. });
  432. //已上门
  433. $('#has_come_container').click(function () {
  434. console.log();
  435. if($('#formProductName').html()=='民宿保洁'){
  436. /*调出表单*/
  437. $('#orderForm').removeClass('am-hide');
  438. $('#orderForm1').removeClass('am-hide');
  439. }else {
  440. /*调用手写板*/
  441. $('#has_come_container').addClass('am-hide');
  442. $('#has_come_success').removeClass('am-hide');
  443. $('#pics').css('display', 'block');
  444. $('.js-signature').eq(0).on('jq.signature.changed', function () {
  445. $('#saveBtn').attr('disabled', false);
  446. });
  447. }
  448. // return false;
  449. });
  450. });
  451. function putb64() {
  452. var pic = url.replace("data:image/png;base64,", "");//需要提交的base64
  453. var uri = "http://up.qiniu.com/putb64/-1";//提交地址
  454. var xhr = new XMLHttpRequest();
  455. xhr.onreadystatechange = function () {
  456. if (xhr.readyState == 4) {
  457. $.post(
  458. '/index.php?r=o2o/myOrder/techComplete',
  459. {
  460. order: order,
  461. user: user,
  462. o2oImage: xhr.responseText
  463. },
  464. function (res) {
  465. $.vloading('close');
  466. var data = $.parseJSON(res);
  467. if (data.success) {
  468. $('#setout_container').addClass('am-hide');
  469. $('#come_container').addClass('am-hide');
  470. $('#has_come_container').addClass('am-hide');
  471. $('#has_come_success').removeClass('am-hide');
  472. } else {
  473. $.valert(data.msg);
  474. }
  475. }
  476. );
  477. }
  478. }
  479. xhr.open("POST", uri, true);
  480. xhr.setRequestHeader("Content-Type", "application/octet-stream");
  481. xhr.setRequestHeader("Authorization", "UpToken Kn8GNMFOLKTNMUaKZ6r1wnjsgTk4ideQifK3umUr:a-HCK5r5iPL8Bisb-mQLI21oZJM=:eyJzY29wZSI6ImF2YXRhcnMiLCJkZWFkbGluZSI6MTQ3NDQ1MTg0OTAwMDAwMDAwMH0=");
  482. xhr.send(pic);
  483. }
  484. function saveSignature() {
  485. $('#signature').empty();
  486. url = $('.js-signature').eq(0).jqSignature('getDataURL');
  487. if (url != undefined) {
  488. $('#pics').css('display', 'none');
  489. //七牛上传照片
  490. putb64();
  491. }
  492. }
  493. function clearCanvas() {
  494. $('.js-signature').eq(0).jqSignature('clearCanvas');
  495. $('#saveBtn').attr('disabled', true);
  496. }
  497. function getOrderInfo(order, user) {
  498. if (order.length == 0 || user.length == 0) {
  499. $.valert('订单信息未录入');
  500. return false;
  501. }
  502. $.vloading('open');
  503. $.post(
  504. '/index.php?r=o2o/o2oApp/getOrderInfo',
  505. {
  506. id: order,
  507. user: user
  508. },
  509. function (res) {
  510. $.vloading('close');
  511. var data = $.parseJSON(res);
  512. if (data.success == false) {
  513. $.valert(data.msg);
  514. } else {
  515. var content = data.content;
  516. v_order.info = content;
  517. for (var j in content.technicians) {
  518. if (content.technicians[j]['technician_id'] == user) {
  519. if (content.status != 4 && content.status != 5 && content.status != 6 && $.inArray(content.status, [1, 2, 3]) != -1) {
  520. $('#confirm_container').removeClass('am-hide');
  521. $('#setout_container').addClass('am-hide');
  522. $('#come_container').addClass('am-hide');
  523. $('#has_come_container').addClass('am-hide');
  524. } else if (content.status == 4) {
  525. $('#setout_container').addClass('am-hide');
  526. $('#come_container').removeClass('am-hide');
  527. $('#has_come_container').addClass('am-hide');
  528. } else if (content.status == 5) {
  529. $('#setout_container').addClass('am-hide');
  530. $('#come_container').addClass('am-hide');
  531. $('#has_come_container').removeClass('am-hide');
  532. } else if (content.status == 6) {
  533. $('#setout_container').addClass('am-hide');
  534. $('#come_container').addClass('am-hide');
  535. $('#has_come_container').addClass('am-hide');
  536. $('#has_come_success').removeClass('am-hide');
  537. }
  538. break;
  539. }
  540. }
  541. $('#info_content').show();
  542. }
  543. }
  544. );
  545. }
  546. </script>