orderdtl.html 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726
  1. <!DOCTYPE html>
  2. <html>
  3. <head>
  4. <meta charset="utf-8">
  5. <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0" />
  6. <meta name="format-detection" content="telephone=no,email=no,date=no,address=no">
  7. <title></title>
  8. <link rel="stylesheet" type="text/css" href="../../css/api.css" />
  9. <link rel="stylesheet" type="text/css" href="../../css/weui.min.css" />
  10. <link rel="stylesheet" type="text/css" href="../../css/style.css" />
  11. <style>
  12. body{background: #f2f2f2;}
  13. .order-status{
  14. font-size: 0.26rem;
  15. width: 100%;
  16. padding: 0.21rem 0;
  17. margin-bottom: 0.17rem;
  18. }
  19. .order-postaddr{
  20. width: 100%;
  21. padding: 0.32rem 0;
  22. }
  23. #state-btn{
  24. width:100%;
  25. }
  26. .order-btn{
  27. width:100%;
  28. background:#ffffff;
  29. border-top:1px solid #e8e8e8;
  30. position:fixed;
  31. bottom:0px;
  32. }
  33. .order-btn li{
  34. float:left;
  35. width:50%;
  36. height: 0.9rem;
  37. line-height: 0.9rem;
  38. text-align:center;
  39. font-size: 0.32rem;
  40. border-right:1px solid #e8e8e8;
  41. box-sizing:border-box;
  42. }
  43. .to-pay{
  44. color:#ffffff; background:#D60E15;
  45. }
  46. .order-list {
  47. margin-bottom: 0.9rem;
  48. }
  49. .order-list-right p {
  50. font-size: 0.22rem;
  51. color: #999;
  52. }
  53. p.font-size-18 {
  54. color: #666;
  55. height: auto;
  56. }
  57. .h5 {
  58. background: #f2f2f2;
  59. margin: 0 0 0 -0.32rem;
  60. width: 7.5rem;
  61. }
  62. .service_btn{clear: both; position: relative; text-align: right; padding:0.32rem; padding-top:0; padding-right:0;}
  63. .service_btn a{
  64. position: relative;
  65. display: inline-block;
  66. box-sizing: border-box;
  67. margin: 0;
  68. padding: 0.16rem;
  69. font-size: 0.24rem;
  70. line-height: 1.2;
  71. text-align: center;
  72. border-radius: 2px;
  73. cursor: pointer;
  74. -webkit-transition: opacity 0.2s;
  75. transition: opacity 0.2s;
  76. -webkit-appearance: none;
  77. color: #323233;
  78. background-color: #fff;
  79. border: 1px solid #ebedf0;
  80. }
  81. .weui-mask {
  82. position: fixed;
  83. z-index:998;
  84. top: 0;
  85. right: 0;
  86. left: 0;
  87. bottom: 0;
  88. background: rgba(0, 0, 0, .6);
  89. display: none;
  90. }
  91. .openSelect{
  92. position: absolute;
  93. position: fixed;
  94. left: 10%;
  95. right: 10%;
  96. background-color: #fff;
  97. border-radius: 10px;
  98. z-index: 999;
  99. top: 20%;
  100. display: none;
  101. }
  102. .openSelect .change-room{
  103. width: 0.4rem;
  104. height: 0.4rem;
  105. }
  106. .addr-room{
  107. color: #222;
  108. padding: 0.26rem 0.4rem;
  109. border-bottom: 1px solid #f1f1f1;
  110. }
  111. .openSelect .selectTitle{
  112. padding:0.3rem 0.4rem;
  113. border-bottom: 1px solid #f1f1f1;
  114. color: #999999;
  115. }
  116. .btns div{
  117. text-align: center;
  118. padding:0.3rem 0.4rem;
  119. color: #222;
  120. }
  121. .btns div:nth-child(2){
  122. border-left: 1px solid #f1f1f1;
  123. color: #D60E15;
  124. }
  125. .openSelect .textarea{
  126. padding:0.3rem 0.4rem;
  127. width: 100%;
  128. box-sizing: border-box;
  129. border-bottom: 1px solid #f1f1f1;
  130. display: none;
  131. }
  132. </style>
  133. <script>
  134. (function(w, d, m) {
  135. function r() {
  136. var t = 100,
  137. o = 750,
  138. e = d.documentElement.clientWidth || w.innerWidth,
  139. n = m.max(m.min(e, 480), 320),
  140. h = 50;
  141. 320 >= n && (h = m.floor(n / o * t * .99)),
  142. n > 320 && 362 >= n && (h = m.floor(n / o * t * 1)),
  143. n > 362 && 375 >= n && (h = m.floor(n / o * t * 1)),
  144. n > 375 && (h = m.floor(n / o * t * .97)),
  145. d.querySelector("html").style.fontSize = (e / 7.5) + "px"
  146. };
  147. r();
  148. w.onresize = function() {
  149. r()
  150. }
  151. })(window, document, Math);
  152. </script>
  153. </head>
  154. <body>
  155. <div class="topbar"></div>
  156. <header class="back-header back-header-bottom">
  157. <ul>
  158. <li class="padding-20 back-btn"><img class="back-header-ico" src="../../image/nav_button_back_default.png" /></li>
  159. <li class="back-header-title">订单详情</li>
  160. <li class="more-btn"></li>
  161. </ul>
  162. </header>
  163. <section class="white-back" style="padding-top: 1.01rem;">
  164. <div id="order-status" class="order-status"></div>
  165. </section>
  166. <section class="white-back" style="margin-bottom: 0.17rem;">
  167. <div class="order-postaddr">
  168. <span id="contact-name"></span>
  169. <p id="contact-addr"></p>
  170. </div>
  171. </section>
  172. <section class="order-list white-back">
  173. </section>
  174. <div id="state-btn"></div>
  175. <div class="openSelect">
  176. <div class="selectTitle">请选择退款的理由</div>
  177. <div class="white-back">
  178. <div class="flex-box flex-v-ce addr-room" onclick="activeSelect(this,1)">
  179. <span class="flex-1">拍错/多拍/不想要</span>
  180. <img class="change-room img1" tag="set-addr" src="../../image/checked.png" />
  181. </div>
  182. <div class="addr-room flex-box flex-v-ce" onclick="activeSelect(this,2)">
  183. <span class="flex-1">协商一致退货</span>
  184. <img class="change-room" tag="set-addr" src="../../image/checkun.png" />
  185. </div>
  186. <div class="addr-room flex-box flex-v-ce" onclick="activeSelect(this,3)">
  187. <span class="flex-1">缺货</span>
  188. <img class="change-room" tag="set-addr" src="../../image/checkun.png" />
  189. </div>
  190. <div class="addr-room flex-box flex-v-ce" onclick="activeSelect(this,4)">
  191. <span class="flex-1">未按约定时间发货</span>
  192. <img class="change-room" tag="set-addr" src="../../image/checkun.png" />
  193. </div>
  194. <div class="addr-room flex-box flex-v-ce" onclick="activeSelect(this,5)">
  195. <span class="flex-1">其他</span>
  196. <img class="change-room" tag="set-addr" src="../../image/checkun.png" />
  197. </div>
  198. <textarea rows="3" placeholder="请输入理由" class="textarea"></textarea>
  199. </div>
  200. <div class="flex-box btns">
  201. <div class="flex-1" onclick="closeRefund()">取消</div>
  202. <div class="flex-1" onclick="activeRefund()">确定</div>
  203. </div>
  204. </div>
  205. <div class="weui-mask"></div>
  206. </body>
  207. <script type="text/javascript" src="../../script/api.js"></script>
  208. <script type="text/javascript" src="../../script/jquery.min.js"></script>
  209. <script type="text/javascript" src="../../script/jquery.tap.js"></script>
  210. <script type="text/javascript" src="../../script/imagesloaded.pkgd.min.js"></script>
  211. <script type="text/javascript">
  212. var _keyid = '';
  213. var str="拍错/多拍/不想要";
  214. var index=1;
  215. apiready = function() {
  216. _keyid = api.pageParam.keyid;
  217. setFixStatusBar();
  218. getRouteData(_keyid);
  219. // getAddrData(_keyid);
  220. api.addEventListener({
  221. name: 'resume'
  222. }, function(ret, err) {
  223. freshen_page();
  224. });
  225. api.addEventListener({
  226. name: 'viewappear'
  227. }, function(ret, err) {
  228. freshen_page();
  229. });
  230. };
  231. function freshen_page() {
  232. $("#contact-name").html('');
  233. $("#contact-addr").html('');
  234. $("#order-status").html('');
  235. $(".order-list").html('');
  236. $("#state-btn").html('');
  237. getRouteData(_keyid);
  238. }
  239. function getRouteData(_keyid) {
  240. toast_loding_show();
  241. $.ajax({
  242. url: siteurl + 'v2/order/info',
  243. data: {
  244. order_id: _keyid
  245. },
  246. headers: {
  247. "X-TOKEN": $api.getStorage("accesstoken")
  248. },
  249. dataType: 'json',
  250. type: 'post',
  251. success: function(datas) {
  252. toast_loding_hide();
  253. if (!datas.result) {
  254. api.toast({
  255. msg: '订单信息获取失败!'
  256. });
  257. return false;
  258. }
  259. var item = datas.data;
  260. var _html = '';
  261. // $.each(datas, function(index, item) {
  262. _html += '<div class="order-list-title" state="' + item.order_state + '" keyid="' + item.order_id +
  263. '"><img src="' + siteurl + 'uploads/home/store/' + item.storeid + '/' + item.store_avatar + '"/> ' + item.store_name +
  264. '</div>';
  265. $.each(item.goods, function(index2, item2) {
  266. var arr = item2.goods_name.split(" ");
  267. var name_arr = arr[0];
  268. var size_arr = item2.goods_name.replace(name_arr, "");
  269. _html += '<div class="order-list-goods" goods_commonid="' + item2.goods_commonid + '" storeid="' + item2.store_id +
  270. '" keyid="' + item2.goods_id + '"><ul><li><img src="' + siteurl + 'uploads/home/store/goods/' + item2.goods_image
  271. .substr(0, item2.goods_image.indexOf("\_")) + '/' + item2.goods_image + '"/></li>';
  272. _html += '<li class="order-list-right"><span class="font-rem11">' + name_arr + '</span><p>' + size_arr +
  273. ' x' + item2.goods_num + '</p>';
  274. _html += '<p class="font-size-18">¥' + item2.goods_price + '</p></li>';
  275. if (item.order_state == 40 && item.evaluation_state == 0 && item2.status == 2 && item.payment_code !=
  276. 'point') {
  277. _html += '<div class="service_btn"><a href="javascript:void(0);" data-goods_id="' + item2.goods_id +
  278. '">退货退款</a></div>';
  279. }
  280. if (item2.status == 3) {
  281. _html += '<div class="service_btn"><a href="javascript:void(0);" data-refund_id="' + item2.or_id +
  282. '" data-goods_id="' + item2.goods_id + '">退款申请中</a></div>';
  283. }
  284. if (item2.status == 4) {
  285. _html += '<div class="service_btn"><a href="javascript:void(0);" data-refund_id="' + item2.or_id +
  286. '" data-goods_id="' + item2.goods_id + '">已退款</a></div>';
  287. }
  288. _html += '</ul></div><div class="h2"></div>';
  289. });
  290. _html += '<div class="order-list-title" style="border-bottom:none;border-top: 1px solid #e8e8e8;">运费:' + item.shipping_fee +
  291. ' <span style="margin-left: 0.2rem;">合计:¥' + item.order_amount + '</span></div>';
  292. _html += '<div class="order-list-title" style="border-bottom:none;">订单编号:' + item.order_sn +
  293. '</div><div class="h5"></div>';
  294. if (item.shipping_code) {
  295. _html += '<div class="order-list-title" style="border-bottom:none;">快递单号:' + item.shipping_code +
  296. '&nbsp;&nbsp;(&nbsp;' + item.express_name + '&nbsp;)</div><div class="h5"></div>';
  297. }
  298. $("#contact-name").html(datas.data.reciver_name + " " + datas.data.reciver_info.phone);
  299. $("#contact-addr").html(datas.data.reciver_info.address);
  300. item.payment_time = item.payment_time ? item.payment_time : '未支付';
  301. item.delay_time = item.delay_time ? item.delay_time : '未发货';
  302. item.finnshed_time = item.finnshed_time ? item.finnshed_time : '未确认';
  303. _html += '<div class="order-list-title" style="border-bottom:none;">下单时间:' + item.add_time + '</div>';
  304. _html += '<div class="order-list-title" style="border-bottom:none;">支付订单:' + item.payment_time + '</div>';
  305. _html += '<div class="order-list-title" style="border-bottom:none;">商家发货:' + item.delay_time + '</div>';
  306. _html += '<div class="order-list-title" style="border-bottom:none;">确认收货:' + item.finnshed_time + '</div>';
  307. // });
  308. $(".order-list").append(_html);
  309. function_name();
  310. if (item.refund_state == 1) {
  311. $("#order-status").html("等待酒店处理退货申请");
  312. } else {
  313. $("#order-status").html(item.status);
  314. }
  315. if (item.order_state == 10) {
  316. $("#state-btn").append(
  317. '<div class="order-btn"><ul><li id="order-cancel" >取消订单</li><li class="to-pay" keyid="' + item.order_id +
  318. '">去付款(¥' + item.order_amount + ')</li></ul></div>');
  319. }
  320. if (item.order_state == 20) {
  321. if (item.shipping_type == 0) {
  322. $("#state-btn").append('<div class="order-btn" id="order-cancel" ><ul><li class="o-refund" keyid="' + item.order_id +
  323. '">退款</li><li class="urge" keyid="' + item.order_id + '">催单</li></ul></div>');
  324. } else {
  325. $("#state-btn").append('<div class="order-btn" id="order-cancel" ><ul><li class="o-refund" keyid="' + item.order_id +
  326. '">退款</li><li class="contacthotel" keyid="' + item.order_id + '">联系酒店</li></ul></div>');
  327. }
  328. }
  329. if (item.order_state == 30) {
  330. $("#state-btn").append(
  331. '<div class="order-btn" id="order-cancel" ><ul><li class="confirm" style="width:100%;border-right:none;">确认收货</li></ul></div>'
  332. );
  333. }
  334. if (item.order_state == 40) {
  335. if (item.refund_state == 0) {
  336. if (item.evaluation_state == 0) {
  337. $("#state-btn").append(
  338. '<div class="order-btn" id="order-return"><ul><li class="evaluate" style="width: 100%">去评价</li></ul></div>'
  339. );
  340. } else {
  341. //$("#state-btn").append('<div class="order-btn" id="order-return"><ul><li style="width: 100%">退换货申请</li></ul></div>');
  342. }
  343. // if (item.status = '已完成') {
  344. // $("#state-btn").append('<div class="order-btn" id="order-del" ><ul><li style="width:100%;border-right:none;">删除订单</li></ul></div>');
  345. // }
  346. }
  347. if (item.refund_state == 4 && item.evaluation_state == 0) {
  348. $("#state-btn").append(
  349. '<div class="order-btn" id="order-return"><ul><li class="evaluate" style="width: 100%">去评价</li></ul></div>'
  350. );
  351. }
  352. if (item.refund_state == 2 || item.refund_state == 3 || item.refund_state == 4) {
  353. $("#state-btn").append(
  354. '<div class="order-btn" id="order-del" ><ul><li style="width:100%;border-right:none;">删除订单</li></ul></div>'
  355. );
  356. }
  357. }
  358. if (item.order_state == 0) {
  359. $("#state-btn").append(
  360. '<div class="order-btn" id="order-del" ><ul><li style="width:100%;border-right:none;">删除订单</li></ul></div>'
  361. );
  362. }
  363. }
  364. });
  365. }
  366. ///
  367. function getAddrData(_keyid) {
  368. $.ajax({
  369. url: rooturl + '?do=getordercommon',
  370. data: {
  371. memberid: $api.getStorage("memberid"),
  372. order_id: _keyid
  373. },
  374. dataType: 'json',
  375. type: 'post',
  376. success: function(datas) {
  377. $("#contact-name").html(datas.reciver_name + " " + datas.reciver_info.phone);
  378. $("#contact-addr").html(datas.reciver_info.address);
  379. }
  380. });
  381. }
  382. ///
  383. $("#state-btn").on("tap", ".to-pay", function() {
  384. var _keyid = $(this).attr("keyid");
  385. api.openWin({
  386. name: 'paymode',
  387. url: '../home/paymode.html',
  388. bounces: false,
  389. pageParam: {
  390. keyid: _keyid
  391. }
  392. });
  393. return false;
  394. })
  395. $("#state-btn").on("tap", ".urge", function() {
  396. var _keyid = $(this).attr("keyid");
  397. api.openWin({
  398. name: 'urge',
  399. url: './urge.html',
  400. bounces: false,
  401. pageParam: {
  402. keyid: _keyid
  403. }
  404. });
  405. return false;
  406. })
  407. //选择理由
  408. function activeSelect(_this,items){
  409. $(".change-room").attr("src", "../../image/checkun.png");
  410. $(_this).find("img").attr("src", "../../image/checked.png");
  411. str=$(_this).find("span").html();
  412. index=items;
  413. if(index==5){
  414. $(".textarea").fadeIn();
  415. }else{
  416. $(".textarea").fadeOut();
  417. }
  418. }
  419. //取消退款
  420. function closeRefund(){
  421. $(".openSelect").fadeOut();
  422. $(".weui-mask").fadeOut();
  423. $(".textarea").fadeOut();
  424. str="拍错/多拍/不想要";
  425. index=1;
  426. $(".textarea").value="";
  427. $(".change-room").attr("src", "../../image/checkun.png");
  428. $(".img1").attr("src", "../../image/checked.png");
  429. return false;
  430. }
  431. //确认退款
  432. function activeRefund(){
  433. if(index==5){
  434. str=$('.textarea').val();
  435. if(str==''){
  436. api.toast({msg: '请输入退款理由'});
  437. return false;
  438. }
  439. }
  440. console.log(_keyid,str);
  441. toast_loding_show();
  442. $.ajax({
  443. url: siteurl + 'v3/Order/refund_direct',
  444. data: {
  445. order_id: _keyid,
  446. remark:str
  447. },
  448. headers: {
  449. "X-TOKEN": $api.getStorage("accesstoken")
  450. },
  451. dataType: 'json',
  452. type: 'post',
  453. success: function(datas) {
  454. console.log(JSON.stringify(datas));
  455. toast_loding_hide();
  456. if (datas.result) {
  457. api.toast({msg: '操作成功!'});
  458. refreshData();
  459. setTimeCloseWin("orderdtl");
  460. } else {
  461. closeRefund();
  462. errcode(datas, datas.code);
  463. }
  464. }
  465. });
  466. return false;
  467. }
  468. //退款
  469. $("#state-btn").on("tap", ".o-refund", function() {
  470. _keyid=$(this).attr("keyid");
  471. $(".openSelect").fadeIn('200');
  472. $(".weui-mask").fadeIn('200');
  473. return false;
  474. })
  475. $("#state-btn").on("tap", ".contacthotel", function() {
  476. var _keyid = $(this).attr("keyid");
  477. api.openWin({
  478. name: 'contacthotel',
  479. url: './contacthotel.html',
  480. bounces: false,
  481. pageParam: {
  482. keyid: _keyid
  483. }
  484. });
  485. return false;
  486. })
  487. $(".order-list").on("tap", ".service_btn a", function(e) {
  488. e.stopPropagation()
  489. var goods_id = $(this).attr("data-goods_id");
  490. var refund_id = $(this).attr("data-refund_id");
  491. if (refund_id * 1 > 0) {
  492. api.openWin({
  493. name: 'refund_orderdtl',
  494. url: '../order/refund_orderdtl.html',
  495. bounces: false,
  496. pageParam: {
  497. goods_id: goods_id,
  498. order_id: _keyid,
  499. keyid: refund_id
  500. }
  501. });
  502. return false
  503. }
  504. api.openWin({
  505. name: 'order_return',
  506. url: './order_return.html',
  507. bounces: false,
  508. pageParam: {
  509. keyid: _keyid,
  510. goods_id: goods_id
  511. }
  512. });
  513. })
  514. $(".order-list").on("tap", ".order-list-goods", function() {
  515. var _keyid = $(this).attr("keyid");
  516. var _storeid = $(this).attr("storeid");
  517. var _goods_commonid = $(this).attr("goods_commonid");
  518. if (_goods_commonid == 0) {
  519. return false;
  520. }
  521. api.openWin({
  522. name: 'showgoods',
  523. url: '../home/showgoods.html',
  524. bounces: false,
  525. pageParam: {
  526. keyid: _goods_commonid,
  527. storeid: _storeid,
  528. }
  529. });
  530. return false;
  531. })
  532. $("#state-btn").on("tap", "#order-cancel", function() {
  533. api.confirm({
  534. title: '是否取消订单',
  535. buttons: ['取消', '确定']
  536. }, function(ret, err) {
  537. var index = ret.buttonIndex;
  538. if (index == 2) {
  539. toast_loding_show();
  540. $.ajax({
  541. url: siteurl + 'v2/order/cancel',
  542. data: {
  543. order_id: _keyid,
  544. memberid: $api.getStorage("memberid"),
  545. type: 'user'
  546. },
  547. headers: {
  548. "X-TOKEN": $api.getStorage("accesstoken")
  549. },
  550. dataType: 'json',
  551. type: 'post',
  552. success: function(datas) {
  553. toast_loding_hide();
  554. if (datas.result) {
  555. // alert(JSON.stringify(datas));
  556. api.toast({
  557. msg: '操作成功!'
  558. });
  559. refreshData();
  560. setTimeCloseWin("orderdtl");
  561. } else {
  562. // alert(JSON.stringify(datas));
  563. errcode(datas, datas.code);
  564. }
  565. }
  566. });
  567. }
  568. })
  569. return false;
  570. })
  571. ////退款
  572. $("#state-btn").on("tap", "#order-return", function() {
  573. api.openWin({
  574. name: 'order_return',
  575. url: './order_return.html',
  576. bounces: false,
  577. pageParam: {
  578. keyid: _keyid
  579. }
  580. });
  581. return
  582. api.confirm({
  583. title: '是否申请退换货',
  584. buttons: ['取消', '确定']
  585. }, function(ret, err) {
  586. var index = ret.buttonIndex;
  587. if (index == 2) {
  588. toast_loding_show();
  589. $.ajax({
  590. url: siteurl + 'v2/order/refund',
  591. data: {
  592. order_id: _keyid,
  593. memberid: $api.getStorage("memberid"),
  594. type: 'user'
  595. },
  596. headers: {
  597. "X-TOKEN": $api.getStorage("accesstoken")
  598. },
  599. dataType: 'json',
  600. type: 'post',
  601. success: function(datas) {
  602. toast_loding_hide();
  603. if (datas.result) {
  604. api.toast({
  605. msg: '您的退换货申请已经提交,商户客服人员会尽快联系您!',
  606. duration: 3000,
  607. location: 'middle'
  608. });
  609. refreshData();
  610. setTimeout(function() {
  611. api.closeWin({
  612. name: "orderdtl"
  613. });
  614. }, 2500);
  615. } else {
  616. errcode(datas, datas.code);
  617. }
  618. }
  619. });
  620. }
  621. })
  622. return false;
  623. })
  624. $("#state-btn").on("tap", ".confirm", function() {
  625. api.confirm({
  626. title: '是否确认收货',
  627. buttons: ['取消', '确定']
  628. }, function(ret, err) {
  629. var index = ret.buttonIndex;
  630. if (index == 2) {
  631. $.ajax({
  632. url: siteurl + 'v2/order/confirm', //'?do=orderconfirm',
  633. data: {
  634. memberid: $api.getStorage("memberid"),
  635. order_id: _keyid
  636. },
  637. headers: {
  638. "X-TOKEN": $api.getStorage("accesstoken")
  639. },
  640. dataType: 'json',
  641. type: 'post',
  642. success: function(datas) {
  643. if (datas.result) {
  644. api.toast({
  645. msg: '操作成功!'
  646. });
  647. refreshData();
  648. setTimeCloseWin("orderdtl");
  649. } else {
  650. errcode(datas, datas.code);
  651. }
  652. }
  653. });
  654. }
  655. })
  656. return false;
  657. })
  658. $("#state-btn").on("tap", ".evaluate", function() {
  659. api.openWin({
  660. name: 'evaluate',
  661. url: './evaluate.html',
  662. bounces: false,
  663. pageParam: {
  664. keyid: _keyid
  665. }
  666. });
  667. return false;
  668. })
  669. $("#state-btn").on("tap", "#order-del", function() {
  670. api.confirm({
  671. title: '是否要删除订单',
  672. buttons: ['取消', '确定']
  673. }, function(ret, err) {
  674. var index = ret.buttonIndex;
  675. if (index == 2) {
  676. $.ajax({
  677. url: siteurl + 'v2/order/drop', //'?do=orderdel',
  678. data: {
  679. order_id: _keyid,
  680. memberid: $api.getStorage("memberid")
  681. },
  682. headers: {
  683. "X-TOKEN": $api.getStorage("accesstoken")
  684. },
  685. dataType: 'json',
  686. type: 'post',
  687. success: function(datas) {
  688. if (datas.result) {
  689. api.toast({
  690. msg: '操作成功!'
  691. });
  692. refreshData();
  693. setTimeCloseWin("orderdtl");
  694. } else {
  695. errcode(datas, datas.code);
  696. }
  697. }
  698. });
  699. }
  700. })
  701. return false;
  702. })
  703. function refreshData() {
  704. api.execScript({
  705. name: 'index',
  706. frameName: 'frame2',
  707. script: 'getRouteData();'
  708. });
  709. }
  710. </script>
  711. </html>