C端小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

835 lines
24 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 44) + 'px'
  2. var config = require("../../../config/config.js");
  3. var app = getApp();
  4. const Http = require("../../../utils/HttpBasics");
  5. const util = require("../../../utils/util");
  6. const imgurl = require("../../../utils/imgurl");
  7. Page({
  8. /**
  9. * 页面的初始数据
  10. */
  11. data: {
  12. navigationBarHeight,
  13. bannerUrl: imgurl.banner.url,
  14. wmhome: imgurl.wmhome.url,
  15. wmhelp: imgurl.wmhelp.url,
  16. chenggong: imgurl.chenggong.url,
  17. fail: imgurl.fail.url,
  18. data: null,
  19. from: null,
  20. day: null,
  21. hour: null,
  22. min: null,
  23. sec: null,
  24. showPage: false,
  25. discountStatus: null,
  26. disabled: false,
  27. display: "block!important",
  28. showButton1: false
  29. },
  30. /**
  31. * 生命周期函数--监听页面加载
  32. */
  33. onLoad: function(options) {
  34. Http.get({
  35. url: config.api.checkUserStatus,
  36. data: {
  37. token: app.globalData.token
  38. }
  39. }).then(res => {
  40. Http.get({
  41. url: config.api.checkPhoneStatus,
  42. data: {}
  43. }).then(res => {
  44. let that = this;
  45. if (options.orderId || options.orderId && options.from == 'discount') {
  46. if (options.from) {
  47. that.setData({
  48. orderId: options.orderId,
  49. from: "discount"
  50. })
  51. } else {
  52. that.setData({
  53. orderId: options.orderId
  54. })
  55. }
  56. app.globalData.wmorder = options.orderId
  57. that.pressOrderDetail(options.orderId);
  58. }
  59. this.getUserInfo()
  60. }).catch(res=>{
  61. wx.redirectTo({
  62. url: `/pages/getphoneInfo/index`
  63. });
  64. })
  65. }).catch(res => {
  66. wx.redirectTo({
  67. url: `/pages/getuserinfo/index`
  68. })
  69. })
  70. },
  71. getUserInfo: function() {
  72. let that = this;
  73. // 获取用户信息
  74. Http.get({
  75. url: config.api.getScore,
  76. data: {}
  77. })
  78. .then(res => {
  79. console.log(res)
  80. that.setData({
  81. nickName: res.data.nickName,
  82. avatarUrl: res.data.avatarUrl
  83. })
  84. })
  85. },
  86. onShow: function() {
  87. let that = this;
  88. var todayDate = new Date().getTime();
  89. that.setData({
  90. todayDate: todayDate,
  91. showButton1: false
  92. })
  93. if (that.data.pressEndDate) {
  94. that.countdown(that.data.pressEndDate)
  95. }
  96. },
  97. goback: function() {
  98. wx.switchTab({
  99. url: '/index/index',
  100. })
  101. },
  102. /**
  103. * 更多砍价商品
  104. */
  105. gotomore: function() {
  106. wx.navigateTo({
  107. url: '/pages/bargain/bargain',
  108. })
  109. },
  110. /**
  111. * @param {砍价状态(1:我发起的砍价,2:未参与的砍价, 3:已参与的砍价)} orderId
  112. */
  113. getPressOrderStatus: function(orderId) {
  114. let that = this;
  115. Http.get({
  116. url: config.api.getPressOrderStatus,
  117. data: {
  118. orderId: orderId
  119. }
  120. })
  121. .then(res => {
  122. if (res.data.status == 1) {
  123. that.setData({
  124. discountStatus: 1
  125. })
  126. } else if (res.data.status == 2) {
  127. that.setData({
  128. discountStatus: 2
  129. })
  130. } else if (res.data.status == 3) {
  131. that.setData({
  132. discountStatus: 3
  133. })
  134. }
  135. wx.stopPullDownRefresh();
  136. })
  137. .catch(err => {
  138. console.log(err)
  139. wx.stopPullDownRefresh();
  140. wx.showToast({
  141. title: err.errMsg,
  142. icon: "none"
  143. })
  144. })
  145. },
  146. helpDiscount: function() {
  147. let that = this;
  148. that.pressOrderJoin(that.data.orderId);
  149. },
  150. //参与砍价
  151. pressOrderJoin: function(orderId) {
  152. let that = this;
  153. Http.post({
  154. url: config.api.pressOrderJoin,
  155. data: {
  156. orderId: orderId
  157. }
  158. })
  159. .then(res => {
  160. console.log(res);
  161. // id 是订单号
  162. that.pressOrderDetail(orderId);
  163. })
  164. .catch(err => {
  165. console.log(err)
  166. wx.showToast({
  167. title: err.message,
  168. icon: "none"
  169. })
  170. })
  171. },
  172. // 订单详情
  173. pressOrderDetail: function(orderId) {
  174. let that = this;
  175. Http.get({
  176. url: config.api.pressOrderDetail,
  177. data: {
  178. orderId: orderId
  179. }
  180. })
  181. .then(res => {
  182. console.log(res);
  183. res.data.orderPressList.map(file => {
  184. file.createDate = diffTime(file.createDate)
  185. })
  186. that.countdown(res.data.pressEndDate);
  187. that.setData({
  188. pressEndDate: res.data.pressEndDate
  189. })
  190. res.data.orderPressList.map(file => {
  191. compare(file.first);
  192. })
  193. console.log(res.data.orderPressList.sort(compare('first')))
  194. that.setData({
  195. data: res.data,
  196. already: (res.data.price / 100 - res.data.salePrice / 100 - res.data.pressCurrentValue / 100).toFixed(2),
  197. remain: (res.data.pressCurrentValue / 100).toFixed(2),
  198. showPage: true
  199. })
  200. that.getPressOrderStatus(orderId);
  201. })
  202. .catch(err => {
  203. wx.showToast({
  204. title: err.message,
  205. icon: "none"
  206. })
  207. wx.stopPullDownRefresh();
  208. })
  209. },
  210. setIntervalTime(end_time) {
  211. let that = this;
  212. var EndTime = end_time;
  213. var NowTime = new Date().getTime();
  214. var total_micro_second = EndTime - NowTime || [];
  215. // 渲染倒计时时钟
  216. let obj = that.dateformat(total_micro_second);
  217. if (total_micro_second > 0) {
  218. that.setData({
  219. clock: obj,
  220. day: obj.a1,
  221. hour: obj.b1,
  222. min: obj.c1,
  223. sec: obj.d1,
  224. })
  225. } else {
  226. that.setData({
  227. clock: "00",
  228. day: "00",
  229. hour: "00",
  230. min: "00",
  231. sec: "00",
  232. })
  233. //如果倒计时结束,需要重新查询一下券的状态
  234. // 给getDetail一个标识
  235. }
  236. total_micro_second -= 1000;
  237. },
  238. countdown: function(end_time) {
  239. let that = this;
  240. that.setIntervalTime(end_time);
  241. that.data.setInterval = setInterval(function() {
  242. that.setIntervalTime(end_time);
  243. }, 1000)
  244. },
  245. // 时间格式化输出,如11:03 25:19 每1s都会调用一次
  246. dateformat(micro_second) {
  247. // 总秒数
  248. var second = Math.floor(micro_second / 1000);
  249. // 天数
  250. var day = Math.floor(second / 3600 / 24) < 10 ? "0" + Math.floor(second / 3600 / 24) : Math.floor(second / 3600 / 24);
  251. // 小时
  252. var hr = Math.floor(second / 3600 % 24) < 10 ? "0" + Math.floor(second / 3600 % 24) : Math.floor(second / 3600 % 24);
  253. // 分钟
  254. var min = Math.floor(second / 60 % 60) < 10 ? "0" + Math.floor(second / 60 % 60) : Math.floor(second / 60 % 60);
  255. // 秒
  256. var sec = Math.floor(second % 60) < 10 ? "0" + Math.floor(second % 60) : Math.floor(second % 60);
  257. // return day + "天" + hr + "小时" + min + "分钟" + sec + "秒";
  258. return {
  259. a1: day,
  260. b1: hr,
  261. c1: min,
  262. d1: sec
  263. }
  264. },
  265. payOrderUpdate: (orderId, payOrderId, status, reason, type, _this) => {
  266. let that = this;
  267. console.log(that)
  268. console.log(_this)
  269. // 支付成功
  270. Http.post({
  271. url: config.api.payOrderUpdate,
  272. data: {
  273. payOrderId: payOrderId,
  274. orderId: orderId,
  275. status: status,
  276. reason: reason
  277. }
  278. })
  279. .then(res => {
  280. wx.hideLoading();
  281. _this.setData({
  282. display: "none!important",
  283. })
  284. // 有价券
  285. if (!type && type != 'free') {
  286. wx.navigateTo({
  287. url: `/pages/order/detail/index?orderId=${
  288. orderId
  289. }`
  290. });
  291. } else if (type == 'free') {
  292. wx.navigateTo({
  293. url: `/pages/order/detail/index?orderId=${
  294. orderId
  295. }`
  296. });
  297. }
  298. })
  299. .catch(err => {
  300. console.log(err);
  301. if (!type) {
  302. setTimeout(function() {
  303. _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this);
  304. }, 2000)
  305. }
  306. })
  307. },
  308. /**
  309. * 按原价付款
  310. */
  311. // orderFunc1(e) {
  312. // var that = this;
  313. // let formId = e.detail.formId;
  314. // that.setData({
  315. // showButton: true
  316. // })
  317. // Http.get({
  318. // url: config.api.checkPhoneStatus,
  319. // data: {}
  320. // })
  321. // .then(res => {
  322. // that.setData({
  323. // showButton: false
  324. // })
  325. // /**
  326. // * orderSave 下单
  327. // */
  328. // var data = {
  329. // couponChannelId:e.currentTarget.dataset.couponchannelid,
  330. // couponId:e.currentTarget.dataset.couponid,
  331. // formId:formId
  332. // }
  333. // return Http.post({
  334. // url: config.api.orderSave,
  335. // data: data
  336. // });
  337. // })
  338. // .catch(err => {
  339. // that.setData({
  340. // showButton: true
  341. // })
  342. // if (err.code == 2011) {
  343. // wx.showToast({
  344. // title: "商户信息没找到",
  345. // image: './../../../assets/images/fail.png',
  346. // duration: 2000,
  347. // mask: false
  348. // });
  349. // } else if (err.code == 2013) {
  350. // wx.showToast({
  351. // title: "商户信息禁用",
  352. // image: './../../../assets/images/fail.png',
  353. // duration: 2000,
  354. // mask: false
  355. // });
  356. // } else if (err.code == 3000) {
  357. // wx.showToast({
  358. // title: "库存不足",
  359. // image: './../../../assets/images/fail.png',
  360. // duration: 2000,
  361. // mask: false
  362. // });
  363. // } else if (err.code == 3001) {
  364. // wx.showToast({
  365. // title: "您已超过限购",
  366. // image: './../../../assets/images/fail.png',
  367. // duration: 2000,
  368. // mask: false
  369. // });
  370. // } else if (err.code == 3002) {
  371. // wx.showToast({
  372. // title: "订单失败",
  373. // image: './../../../assets/images/fail.png',
  374. // duration: 2000,
  375. // mask: false
  376. // });
  377. // } else if (err.code == 3003) {
  378. // wx.showToast({
  379. // title: "订单不存在",
  380. // image: './../../../assets/images/fail.png',
  381. // duration: 2000,
  382. // mask: false
  383. // });
  384. // } else if (err.code == 3004) {
  385. // wx.showToast({
  386. // title: "订单不存在",
  387. // image: './../../../assets/images/fail.png',
  388. // duration: 2000,
  389. // mask: false
  390. // });
  391. // } else if (err.code == 4003) {
  392. // wx.showToast({
  393. // title: "卡券已作废",
  394. // image: './../../../assets/images/fail.png',
  395. // duration: 2000,
  396. // mask: false
  397. // });
  398. // } else if (err.code == 3012) {
  399. // wx.showModal({
  400. // title: '提示',
  401. // content: "您有未支付订单进行支付",
  402. // showCancel: false,
  403. // success: function (res) {
  404. // console.log(res.confirm)
  405. // if (res.confirm) {
  406. // }
  407. // }
  408. // })
  409. // }else if (err.code == 11005) {
  410. // /**
  411. // * 将值传到用户手机号授权的页面
  412. // *
  413. // */
  414. // wx.redirectTo({
  415. // url: "/pages/getphoneInfo/index?couponChannelId=" +
  416. // that.data.couponChannelId +
  417. // "&couponId=" +
  418. // that.data.couponId
  419. // });
  420. // } else if (err.code == 11006) {
  421. // // 用户手机已加密
  422. // wx.redirectTo({
  423. // url: "/pages/phoneinput/phoneinput?couponChannelId=" +
  424. // that.data.couponChannelId +
  425. // "&couponId=" +
  426. // that.data.couponId
  427. // });
  428. // } else {
  429. // wx.showToast({
  430. // title: err.message,
  431. // icon: 'none',
  432. // duration: 2000,
  433. // mask: false
  434. // });
  435. // }
  436. // }).then(res => {
  437. // console.log(res);
  438. // if (typeof(res) != "undefined") {
  439. // let orderId = "" + res.data.id;
  440. // that.setData({
  441. // orderId: orderId
  442. // });
  443. // if (e.currentTarget.dataset.saleprice / 100 > 0 || e.currentTarget.dataset.price / 100 > 0) {
  444. // /**
  445. // * 支付订单创建
  446. // */
  447. // Http.post({
  448. // url: config.api.payOrderCreate,
  449. // data: {
  450. // orderId: orderId
  451. // }
  452. // })
  453. // .then(res => {
  454. // var payOrderId = "" + res.data.payOrderId;
  455. // wx.hideLoading();
  456. // wx.requestPayment({
  457. // timeStamp: res.data.timeStamp,
  458. // nonceStr: res.data.nonceStr,
  459. // package: res.data.package,
  460. // signType: (res.data.signType) ? res.data.signType : "MD5",
  461. // paySign: res.data.paySign,
  462. // success: res => {
  463. // wx.showLoading({
  464. // title: '订单正在处理中...',
  465. // })
  466. // setTimeout(function() {
  467. // wx.hideLoading()
  468. // }, 5000)
  469. // that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
  470. // if (res.errMsg == "requestPayment:ok") {
  471. // setTimeout(function() {
  472. // wx.hideLoading();
  473. // }, 2000);
  474. // /**
  475. // * 用户支付成功以后跳转到券包列表
  476. // */
  477. // if (that.data.cardType == 100) {
  478. // wx.setStorage({
  479. // key: 'couponNum2',
  480. // data: "couponNum2"
  481. // })
  482. // } else {
  483. // wx.setStorage({
  484. // key: 'couponNum',
  485. // data: "couponNum"
  486. // })
  487. // }
  488. // }
  489. // },
  490. // fail: res => {
  491. // /**
  492. // * 支付失败,需要更新订单的状态
  493. // */
  494. // that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
  495. // that.setData({
  496. // showbutton: false
  497. // })
  498. // return;
  499. // },
  500. // complete: res => {}
  501. // });
  502. // /// End payment --------
  503. // })
  504. // .catch(err => {
  505. // console.log(err);
  506. // wx.showToast({
  507. // title: err.message,
  508. // icon: 'none',
  509. // duration: 2000,
  510. // mask: false
  511. // });
  512. // })
  513. // } else {
  514. // // 免费券
  515. // that.payOrderUpdate(orderId, "0", 1, '', 'free', that);
  516. // if (that.data.cardType == 100) {
  517. // wx.setStorage({
  518. // key: 'couponNum2',
  519. // data: "couponNum2"
  520. // })
  521. // } else {
  522. // wx.setStorage({
  523. // key: 'couponNum',
  524. // data: "couponNum"
  525. // })
  526. // }
  527. // }
  528. // }
  529. // })
  530. // },
  531. /**
  532. * 发起支付
  533. */
  534. orderFunc(e) {
  535. var that = this;
  536. that.setData({
  537. showButton1: true
  538. })
  539. Http.get({
  540. url: config.api.checkPhoneStatus,
  541. data: {}
  542. })
  543. .then(res => {
  544. that.setData({
  545. showButton1: false
  546. })
  547. if (typeof(res) != "undefined") {
  548. let orderId = "" + e.currentTarget.dataset.orderid;
  549. that.setData({
  550. orderId: orderId
  551. });
  552. if (e.currentTarget.dataset.saleprice / 100 > 0 || e.currentTarget.dataset.price / 100 > 0) {
  553. /**
  554. * 支付订单创建
  555. */
  556. Http.post({
  557. url: config.api.payOrderCreate,
  558. data: {
  559. orderId: orderId
  560. }
  561. })
  562. .then(res => {
  563. var payOrderId = "" + res.data.payOrderId;
  564. wx.hideLoading();
  565. wx.requestPayment({
  566. timeStamp: res.data.timeStamp,
  567. nonceStr: res.data.nonceStr,
  568. package: res.data.package,
  569. signType: (res.data.signType) ? res.data.signType : "MD5",
  570. paySign: res.data.paySign,
  571. success: res => {
  572. wx.showLoading({
  573. title: '订单正在处理中...',
  574. })
  575. setTimeout(function() {
  576. wx.hideLoading()
  577. }, 5000)
  578. that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that);
  579. if (res.errMsg == "requestPayment:ok") {
  580. setTimeout(function() {
  581. wx.hideLoading();
  582. }, 2000);
  583. /**
  584. * 用户支付成功以后跳转到券包列表
  585. */
  586. if (that.data.cardType == 100) {
  587. wx.setStorage({
  588. key: 'couponNum2',
  589. data: "couponNum2"
  590. })
  591. } else {
  592. wx.setStorage({
  593. key: 'couponNum',
  594. data: "couponNum"
  595. })
  596. }
  597. }
  598. },
  599. fail: res => {
  600. /**
  601. * 支付失败,需要更新订单的状态
  602. */
  603. that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that);
  604. that.setData({
  605. showbutton1: false
  606. })
  607. return;
  608. },
  609. complete: res => {}
  610. });
  611. /// End payment --------
  612. })
  613. .catch(err => {
  614. console.log(err);
  615. wx.showToast({
  616. title: err.message,
  617. icon: 'none',
  618. duration: 2000,
  619. mask: false
  620. });
  621. })
  622. } else {
  623. // 免费券
  624. that.payOrderUpdate(orderId, "0", 1, '', 'free', that);
  625. if (that.data.cardType == 100) {
  626. wx.setStorage({
  627. key: 'couponNum2',
  628. data: "couponNum2"
  629. })
  630. } else {
  631. wx.setStorage({
  632. key: 'couponNum',
  633. data: "couponNum"
  634. })
  635. }
  636. }
  637. }
  638. })
  639. .catch(err => {
  640. that.setData({
  641. showButton1: true
  642. })
  643. if (err.code == 2011) {
  644. wx.showToast({
  645. title: "商户信息没找到",
  646. image: './../../../assets/images/fail.png',
  647. duration: 2000,
  648. mask: false
  649. });
  650. } else if (err.code == 2013) {
  651. wx.showToast({
  652. title: "商户信息禁用",
  653. image: './../../../assets/images/fail.png',
  654. duration: 2000,
  655. mask: false
  656. });
  657. } else if (err.code == 3000) {
  658. wx.showToast({
  659. title: "库存不足",
  660. image: './../../../assets/images/fail.png',
  661. duration: 2000,
  662. mask: false
  663. });
  664. } else if (err.code == 3001) {
  665. wx.showToast({
  666. title: "您已超过限购",
  667. image: './../../../assets/images/fail.png',
  668. duration: 2000,
  669. mask: false
  670. });
  671. } else if (err.code == 3002) {
  672. wx.showToast({
  673. title: "订单失败",
  674. image: './../../../assets/images/fail.png',
  675. duration: 2000,
  676. mask: false
  677. });
  678. } else if (err.code == 3003) {
  679. wx.showToast({
  680. title: "订单不存在",
  681. image: './../../../assets/images/fail.png',
  682. duration: 2000,
  683. mask: false
  684. });
  685. } else if (err.code == 3004) {
  686. wx.showToast({
  687. title: "订单不存在",
  688. image: './../../../assets/images/fail.png',
  689. duration: 2000,
  690. mask: false
  691. });
  692. } else if (err.code == 4003) {
  693. wx.showToast({
  694. title: "卡券已作废",
  695. image: './../../../assets/images/fail.png',
  696. duration: 2000,
  697. mask: false
  698. });
  699. } else if (err.code == 3012) {
  700. wx.showModal({
  701. title: '提示',
  702. content: '您有未支付订单,请先进行支付',
  703. confirmText: "去支付",
  704. success: function(res) {
  705. console.log(res.confirm)
  706. if (res.confirm) {
  707. wx.navigateTo({
  708. url: '/pages/order/index/index?id=all',
  709. })
  710. }
  711. }
  712. })
  713. } else if (err.code == 11005) {
  714. /**
  715. * 将值传到用户手机号授权的页面
  716. *
  717. */
  718. wx.redirectTo({
  719. url: "/pages/getphoneInfo/index?couponChannelId=" +
  720. that.data.couponChannelId +
  721. "&couponId=" +
  722. that.data.couponId
  723. });
  724. } else if (err.code == 11006) {
  725. // 用户手机已加密
  726. wx.redirectTo({
  727. url: "/pages/phoneinput/phoneinput?couponChannelId=" +
  728. that.data.couponChannelId +
  729. "&couponId=" +
  730. that.data.couponId
  731. });
  732. } else {
  733. wx.showToast({
  734. title: err.message,
  735. icon: 'none',
  736. duration: 2000,
  737. mask: false
  738. });
  739. }
  740. })
  741. },
  742. onUnload: function() {
  743. let that = this;
  744. clearInterval(that.data.setInterval)
  745. },
  746. onHide: function() {
  747. let that = this;
  748. clearInterval(that.data.setInterval)
  749. },
  750. /**
  751. *
  752. * @param {朋友邀请砍价} e
  753. */
  754. barginAgain: function(e) {
  755. let that = this;
  756. let couponChannelId = e.currentTarget.dataset.couponchannelid;
  757. let couponId = e.currentTarget.dataset.couponid;
  758. wx.navigateTo({
  759. url: `/pages/coupon/detail/index?couponChannelId=${couponChannelId}&couponId=${couponId}`,
  760. })
  761. },
  762. /**
  763. * 刷新
  764. */
  765. onPullDownRefresh: function(e) {
  766. let that = this;
  767. console.log(app.globalData.wmorder);
  768. if (app.globalData.wmorder) {
  769. that.pressOrderDetail(app.globalData.wmorder);
  770. }
  771. },
  772. onShareAppMessage: function(options) {
  773. app.globalData.previewFlag = true
  774. var that = this;
  775. var shareObj = {
  776. title: that.data.nickName + '邀请您帮砍' + that.data.data.title,
  777. path: `/pages/index/index?orderId=${that.data.data.id}&from=${"discount"}`,
  778. success: function(res) {
  779. if (res.errMsg == 'shareAppMessage:ok') {}
  780. },
  781. fail: function(error) {
  782. if (res.errMsg == 'shareAppMessage:fail cancel') {} else if (res.errMsg == 'shareAppMessage:fail') {}
  783. }
  784. };
  785. // 来自页面内的按钮的转发
  786. if (options.from == 'button') {
  787. var orderId = options.target.dataset.orderid;
  788. shareObj.path = `/pages/index/index?orderId=${orderId}&from=${"discount"}`;
  789. }
  790. // 返回shareObj
  791. return shareObj;
  792. },
  793. })
  794. function diffTime(startDate) {
  795. var diff = new Date().getTime() - startDate;
  796. var days = Math.floor(diff / (24 * 3600 * 1000));
  797. var leave1 = diff % (24 * 3600 * 1000);
  798. var hours = Math.floor(leave1 / (3600 * 1000));
  799. var leave2 = leave1 % (3600 * 1000);
  800. var minutes = Math.floor(leave2 / (60 * 1000));
  801. var leave3 = leave2 % (60 * 1000);
  802. var seconds = Math.round(leave3 / 1000);
  803. var returnStr = seconds + "秒";
  804. if (minutes > 0) {
  805. returnStr = minutes + "分" + returnStr;
  806. }
  807. if (hours > 0) {
  808. returnStr = hours + "小时" + returnStr;
  809. }
  810. if (days > 0) {
  811. returnStr = days + "天" + returnStr;
  812. }
  813. if (returnStr.indexOf('-1') == -1) {
  814. return returnStr;
  815. } else {
  816. return '1秒'
  817. }
  818. }
  819. function compare(property) {
  820. return function(a, b) {
  821. var value1 = a[property];
  822. var value2 = b[property];
  823. return value2 - value1;
  824. }
  825. }