抖音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.

851 line
28 KiB

  1. const navigationBarHeight = (getApp().statusBarHeight + 50) + '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. data: {
  9. couponIds: "",
  10. couponChannelId: "",
  11. showPage: false,
  12. data: {},
  13. spuIdObj: {},
  14. priceAndStockObj: {}
  15. },
  16. onLoad: function (options) {
  17. console.log(options);
  18. tt.showLoading({
  19. title: "加载中..."
  20. });
  21. let that = this
  22. if (app.globalData.token) {
  23. if (options && options.couponChannelId) {
  24. that.setData({
  25. couponChannelId: options.couponChannelId
  26. })
  27. that.getDetail(options.couponChannelId, 'notendclock');
  28. }
  29. } else {
  30. app.tokenCallback = token => {
  31. that.setData({
  32. couponChannelId: options.couponChannelId
  33. })
  34. if (options && options.couponChannelId) {
  35. that.getDetail(options.couponChannelId, 'notendclock');
  36. }
  37. }
  38. }
  39. },
  40. goInstructions() {
  41. tt.navigateTo({
  42. url: '/pages/coupon/instructions/instructions?couponChannelId=' + this.data.couponChannelId,
  43. success: (res) => {
  44. },
  45. fail: (res) => {
  46. },
  47. });
  48. },
  49. getSupId(id) {
  50. Http.get({
  51. url: config.api.getSpuid,
  52. data: { id: id }
  53. }).then(res => {
  54. if (res.data) {
  55. this.setData({
  56. spuIdObj: res.data
  57. })
  58. }
  59. }).catch(err => {
  60. // tt.showToast({
  61. // title: err.message,
  62. // icon: 'none',
  63. // duration: 2000,
  64. // mask: false
  65. // });
  66. })
  67. },
  68. getCouponPriceAndStock(couponChannelId) {//获取券价格与库存
  69. Http.get({
  70. url: config.api.couponPriceAndStock,
  71. data: {
  72. couponChannelId
  73. }
  74. }).then(res => {
  75. let tempBoj = JSON.parse(res.data)
  76. console.log(tempBoj, "$");
  77. this.setData({
  78. priceAndStockObj: tempBoj
  79. })
  80. })
  81. },
  82. getDetail: function (couponChannelId, flag) {
  83. let that = this;
  84. let data = {};
  85. that.getCouponPriceAndStock(couponChannelId);//获取券价格和库存
  86. if (that.data.couponIds) {
  87. data.couponId = couponChannelId
  88. } else {
  89. data.couponChannelId = couponChannelId
  90. }
  91. var parmer = {
  92. url: config.api.newCouponDetail,
  93. data: data
  94. };
  95. Http.get(parmer).then(res => {
  96. that.setData({
  97. couponId: res.data.couponId
  98. })
  99. /**
  100. * activityStatus==0 活动未开始
  101. * activityStatus==1 活动已开始
  102. * flag == endclock 说明倒计时已经结束
  103. */
  104. if (res.data.endTime && res.data.beginTime) {
  105. that.setData({
  106. begin_time: res.data.beginTime,
  107. end_time: res.data.endTime,
  108. activityStatus: res.data.actStatus ? res.data.actStatus : ''
  109. })
  110. if (res.data.actStatus == 0 && flag != 'endclock') {
  111. that.countdown(res.data.beginTime);
  112. } else if (res.data.actStatus != 0 && flag != 'endclock') {
  113. that.countdown(res.data.endTime);
  114. } else {
  115. clearInterval(that.data.setInterval)
  116. }
  117. if (res.data.actStatus == 0) {
  118. var beginTime = util.formatTime(res.data.beginTime, "yyyy-MM-dd hh:mm:ss");
  119. if (util.timechuo(beginTime).indexOf('-') == 0) {
  120. that.setData({
  121. beginTime: "活动已结束",
  122. });
  123. } else {
  124. that.setData({
  125. beginTime: util.timechuo(beginTime)
  126. });
  127. }
  128. } else {
  129. var endTime = util.formatTime(res.data.endTime, "yyyy-MM-dd hh:mm:ss");
  130. if (util.timechuo(endTime).indexOf('-') == 0) {
  131. that.setData({
  132. endtime: "活动已结束",
  133. });
  134. } else {
  135. that.setData({
  136. endtime: util.timechuo(endTime)
  137. });
  138. }
  139. }
  140. }
  141. tt.hideLoading();
  142. that.setData({
  143. data: res.data,
  144. });
  145. if (res.data.type == 10) {
  146. that.setData({
  147. salePriceStr: res.data.salePriceStr,
  148. pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"),
  149. pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"),
  150. priceStr: res.data.priceStr,
  151. tailPriceStr: res.data.tailPriceStr,
  152. origPriceStr: res.data.origPriceStr
  153. })
  154. }
  155. if (res.data.validType == 1) {
  156. that.setData({
  157. validStartDate: util.formatTime(res.data.validStartDate, "yyyy-MM-dd"),
  158. validEndDate: util.formatTime(res.data.validEndDate, "yyyy-MM-dd"),
  159. pickStartDate: util.formatTime(res.data.pickStartDate, "yyyy-MM-dd"),
  160. pickEndDate: util.formatTime(res.data.pickEndDate, "yyyy-MM-dd"),
  161. });
  162. } else {
  163. if (res.data.validDays) {
  164. that.setData({
  165. validDays: res.data.validDays
  166. });
  167. }
  168. }
  169. if (res.data.itemGroup) {
  170. let tempObj = this.data.data
  171. tempObj.itemGroup = JSON.parse(tempObj.itemGroup)
  172. this.setData({
  173. data: tempObj
  174. })
  175. console.log(this.data.data, "data");
  176. }
  177. if (res.data.productAttrs && res.data.skuAttrs) {
  178. let tempObj = this.data.data
  179. tempObj.productAttrs = JSON.parse(tempObj.productAttrs)
  180. tempObj.skuAttrs = JSON.parse(tempObj.skuAttrs)
  181. tempObj.productAttrs.map(item => {
  182. if (item.key == "Notification") {
  183. if (item.data != '') {
  184. tempObj.curLsit = JSON.parse(item.data)
  185. }
  186. }
  187. if (item.key == "bring_out_meal") {
  188. tempObj.besides = item.data
  189. }
  190. if (item.key == "free_pack") {
  191. tempObj.pack = item.data
  192. }
  193. if (item.key == "superimposed_discounts") {
  194. tempObj.superimposed_discounts = item.data
  195. }
  196. if (item.key == "private_room") {
  197. tempObj.private_room = item.data
  198. }
  199. if (item.key == "rec_person_num_max") {
  200. tempObj.rec_person_num_max = item.data
  201. }
  202. if (item.key == 'Description') {
  203. tempObj.Description = JSON.parse(item.data)
  204. }
  205. if (item.key == "can_no_use_date") {
  206. tempObj.can_no_use_date = JSON.parse(item.data)
  207. }
  208. })
  209. tempObj.skuAttrs.map(item => {
  210. if (item.key == "commodity") {
  211. if (item.data != '') {
  212. tempObj.itemGroup = JSON.parse(item.data)
  213. }
  214. }
  215. })
  216. this.setData({
  217. data: tempObj
  218. })
  219. console.log(this.data.data, "data");
  220. }
  221. }).catch(err => {
  222. tt.showToast({
  223. title: err.message,
  224. icon: 'none',
  225. duration: 2000,
  226. mask: false
  227. });
  228. })
  229. },
  230. /**
  231. * 支付订单更新
  232. */
  233. payOrderUpdate: (orderId, payOrderId, status, reason, type, _this, composeOrderType) => {
  234. let that = this;
  235. // 支付成功
  236. Http.post({
  237. url: config.api.payOrderUpdate,
  238. data: {
  239. payOrderId: payOrderId,
  240. composeOrderId: orderId,
  241. status: status,
  242. reason: reason
  243. }
  244. })
  245. .then(res => {
  246. tt.hideLoading()
  247. // 有价券
  248. if (!type && type != 'free') {
  249. tt.navigateTo({
  250. url: `/pages/order/detail/index?orderId=${orderId
  251. }`
  252. });
  253. } else if (type == 'free') {
  254. tt.navigateTo({
  255. url: `/pages/order/detail/index?orderId=${orderId
  256. }`
  257. });
  258. }
  259. })
  260. .catch(err => {
  261. console.log(err);
  262. if (!type) {
  263. setTimeout(function () {
  264. _this.payOrderUpdate(orderId, payOrderId, status, reason, type, _this, composeOrderType);
  265. }, 2000)
  266. }
  267. })
  268. },
  269. // 获得未支付的订单
  270. getUnPaidOrder(couponId) {
  271. let that = this;
  272. Http.get({
  273. url: config.api.getUnPaidOrder,
  274. data: {
  275. couponId: couponId
  276. }
  277. }).then(res => {
  278. that.setData({
  279. disOrderNumber: res.data.orderNumber,
  280. composeOrderType: res.data.composeOrderType
  281. })
  282. if (res.data && res.data.pressEndDate) {
  283. that.setData({
  284. dispressEndDate: true
  285. })
  286. } else {
  287. that.setData({
  288. dispressEndDate: false
  289. })
  290. }
  291. if (that.data.dispressEndDate) {
  292. tt.showModal({
  293. title: '提示',
  294. content: "您有未支付订单,请到“我的-我的砍价”进行支付",
  295. confirmText: "我的砍价",
  296. success: function (res) {
  297. if (res.confirm) {
  298. tt.navigateTo({
  299. url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.disOrderNumber}&composeOrderType=${that.data.composeOrderType}`,
  300. })
  301. }
  302. }
  303. })
  304. } else {
  305. tt.showModal({
  306. title: '提示',
  307. content: '您有未支付订单,请先进行支付',
  308. confirmText: "去支付",
  309. success: function (res1) {
  310. if (res1.confirm) {
  311. if (that.data.composeOrderType > 0) {//券包
  312. tt.navigateTo({
  313. url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`,
  314. })
  315. } else {
  316. tt.navigateTo({
  317. url: `/pages/order/detail/index?orderId=${res.data.composeOrderId}`,
  318. })
  319. }
  320. }
  321. }
  322. })
  323. }
  324. }).catch(error => {
  325. tt.showToast({
  326. title: error.message,
  327. icon: "none",
  328. duration: 3000
  329. })
  330. })
  331. },
  332. /**
  333. * 发起支付
  334. */
  335. orderFunc(discount) {
  336. if (this.data.showbutton) return;
  337. let that = this;
  338. tt.showLoading({
  339. title: "加载中..."
  340. });
  341. that.setData({
  342. showbutton: true,
  343. })
  344. Http.get({
  345. url: config.api.checkUserStatus,
  346. data: {
  347. token: app.globalData.token
  348. }
  349. }).then(res => {
  350. Http.get({
  351. url: config.api.checkPhoneStatus,
  352. data: {}
  353. }).then(res => {
  354. //
  355. // if (!tt.canIUse('createOrder') || that.data.data.type == 50 || that.data.priceAndStockObj.salePrice == 0) {
  356. //积分券和免费券
  357. // 发起砍价
  358. if (discount == 'discount') {
  359. var data = {
  360. couponChannelId: "" + that.data.couponChannelId,
  361. couponId: "" + that.data.couponId,
  362. formId: "" + that.data.formId,
  363. press: true
  364. }
  365. } else if (discount == 'discount1') {
  366. var data = {
  367. couponChannelId: "" + that.data.couponChannelId,
  368. couponId: "" + that.data.couponId,
  369. formId: "" + that.data.formId,
  370. press: false
  371. }
  372. } else if (that.data.couponChannelId == null) {
  373. var data = {
  374. couponId: "" + that.data.couponId,
  375. formId: "" + that.data.formId,
  376. };
  377. } else {
  378. var data = {
  379. couponChannelId: "" + that.data.couponChannelId,
  380. couponId: "" + that.data.couponId,
  381. formId: "" + that.data.formId,
  382. }
  383. }
  384. console.log(data, "data")
  385. let url = ""
  386. let tempObj;
  387. let tempArr = []
  388. if (that.data.data.type == 12) {
  389. url = config.api.couponPackageSave
  390. tempObj = {
  391. signleOrder: {
  392. couponChannelId: "" + that.data.couponChannelId,
  393. couponId: "" + that.data.couponId,
  394. formId: "" + that.data.formId,
  395. },
  396. count: "1"
  397. }
  398. tempArr.push(tempObj)
  399. } else {
  400. url = config.api.orderSave
  401. }
  402. /**
  403. * orderSave 下单
  404. */
  405. Http.post({
  406. url: url,
  407. data: that.data.data.type == 12 ? JSON.stringify(tempArr) : data
  408. }).then(res => {
  409. if (discount != 'discount') {
  410. if (typeof (res) != "undefined") {
  411. let orderId = "" + res.data.mainOrderId;
  412. that.setData({
  413. orderId: orderId,
  414. composeOrderType: res.data.composeOrderType
  415. });
  416. if (res.data.payment > 0) {
  417. // 支付金额不为0
  418. if (tt.canIUse('createOrder')) {
  419. Http.post({
  420. url: config.api.payOrderCreate_2,
  421. data: {
  422. orderId: orderId,
  423. composeOrderType: res.data.composeOrderType
  424. }
  425. }).then(res => {
  426. console.log(res,"789789");
  427. let tempCallbackData = {
  428. composeOrderId:res.data.outOrderNo
  429. }
  430. // tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id
  431. let options = {
  432. callbackData: tempCallbackData,
  433. goodsList: res.data.goodsList,
  434. payment: res.data.payment,
  435. success: res => {
  436. tt.hideLoading();
  437. that.setData({
  438. showbutton: false,
  439. })
  440. const { orderId, outOrderNo } = res;
  441. that.setData({ orderId, outOrderNo });
  442. that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, '');
  443. },
  444. fail: res => {
  445. const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
  446. if (errLogId) {
  447. tt.hideLoading();
  448. that.setData({
  449. showbutton: false,
  450. })
  451. console.log('预下单失败', errNo, errMsg, errLogId);
  452. let tempErrmsg = errMsg.split('开发者拒绝交易:');
  453. tt.showToast({
  454. title: tempErrmsg[tempErrmsg.length - 1],
  455. icon: 'none',
  456. duration: 2000,
  457. mask: false
  458. });
  459. }
  460. if (orderId || outOrderNo) {
  461. tt.hideLoading();
  462. that.setData({
  463. showbutton: false,
  464. })
  465. console.log('支付失败', errNo, errMsg, orderId, outOrderNo);
  466. console.log(that.payOrderUpdate, "payOrderUpdate");
  467. tt.showToast({
  468. title: "取消支付",
  469. icon: 'none',
  470. duration: 2000,
  471. mask: false
  472. });
  473. that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail')
  474. }
  475. },
  476. }
  477. console.log(options, "options");
  478. tt.createOrder(options)
  479. })
  480. } else {//不支持2.0支付
  481. /**
  482. * 支付订单创建
  483. */
  484. tt.showToast({
  485. title: '请升级抖音', // 内容
  486. icon: "none"
  487. });
  488. return
  489. Http.post({
  490. url: config.api.payOrderCreate,
  491. data: {
  492. orderId: orderId,
  493. composeOrderType: res.data.composeOrderType
  494. }
  495. }).then(res => {
  496. var payOrderId = "" + res.data.outOrderNo;
  497. tt.hideLoading();
  498. tt.pay({
  499. service: 5,
  500. orderInfo: {
  501. order_id: res.data.payOrderId,
  502. order_token: res.data.payOrderToken,
  503. },
  504. success: res => {
  505. tt.showLoading({
  506. title: '订单正在处理中...',
  507. })
  508. if (res.code === 0) {
  509. that.payOrderUpdate(that.data.orderId, payOrderId, 1, '', '', that, that.data.composeOrderType);
  510. if (res.errMsg == "requestPayment:ok") {
  511. /**
  512. * 用户支付成功以后跳转到券包列表
  513. */
  514. if (that.data.cardType == 100) {
  515. tt.setStorage({
  516. key: 'couponNum2',
  517. data: "couponNum2"
  518. })
  519. } else if (that.data.data.type != 5 && that.data.cardType != 100) {
  520. tt.setStorage({
  521. key: 'couponNum',
  522. data: "couponNum"
  523. })
  524. }
  525. }
  526. }
  527. else if (res.code === 1) {
  528. that.setData({
  529. showbutton: false
  530. })
  531. tt.hideLoading();
  532. tt.showToast({
  533. title: '支付超时', // 内容
  534. icon: "none"
  535. });
  536. } else if (res.code === 2) {
  537. that.setData({
  538. showbutton: false
  539. })
  540. tt.hideLoading();
  541. tt.showToast({
  542. title: '支付失败', // 内容
  543. icon: "none"
  544. });
  545. } else if (res.code === 3) {
  546. that.setData({
  547. showbutton: false
  548. })
  549. tt.hideLoading();
  550. tt.showToast({
  551. title: '支付关闭', // 内容
  552. icon: "none"
  553. });
  554. } else if (res.code === 4) {
  555. that.setData({
  556. showbutton: false
  557. })
  558. tt.hideLoading();
  559. tt.showToast({
  560. title: '支付取消', // 内容
  561. icon: "none"
  562. });
  563. } else if (res.code === 9) {
  564. that.setData({
  565. showbutton: false
  566. })
  567. tt.hideLoading();
  568. tt.showToast({
  569. title: '订单状态开发者自行获取', // 内容
  570. icon: "none"
  571. });
  572. }
  573. },
  574. fail: res => {
  575. tt.hideLoading();
  576. /**
  577. * 支付失败,需要更新订单的状态
  578. */
  579. that.payOrderUpdate(that.data.orderId, payOrderId, 2, '', 'fail', that, that.data.composeOrderType);
  580. that.setData({
  581. showbutton: false
  582. })
  583. return;
  584. },
  585. complete: res => { }
  586. });
  587. /// End payment --------
  588. })
  589. .catch(err => {
  590. tt.hideLoading();
  591. tt.showToast({
  592. title: err.message,
  593. icon: 'none',
  594. duration: 2000,
  595. mask: false
  596. });
  597. })
  598. }
  599. } else {
  600. // 免费券
  601. that.payOrderUpdate(orderId, "0", 1, '', 'free', that, that.data.composeOrderType);
  602. if (that.data.cardType == 100) {
  603. tt.setStorage({
  604. key: 'couponNum2',
  605. data: "couponNum2"
  606. })
  607. } else if (that.data.data.type != "5" && that.data.cardType != 100) {
  608. tt.setStorage({
  609. key: 'couponNum',
  610. data: "couponNum"
  611. })
  612. }
  613. }
  614. }
  615. } else {
  616. if (res) {
  617. tt.navigateTo({
  618. url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${res.data.mainOrderId}&composeOrderType=${res.data.composeOrderType}`,
  619. })
  620. }
  621. }
  622. }).catch(err => {
  623. tt.hideLoading();
  624. that.setData({
  625. showbutton: false,
  626. })
  627. if (err.code == 3012) {
  628. that.getUnPaidOrder(that.data.couponId);
  629. } else {
  630. tt.showToast({
  631. title: err.message ? err.message : err.data,
  632. icon: 'none',
  633. duration: 2000,
  634. success(res) {
  635. console.log(res);
  636. },
  637. fail(res) {
  638. console.log("showToast 调用失败", res);
  639. },
  640. });
  641. }
  642. })
  643. // } else {
  644. // //有价券
  645. // console.log(tt.canIUse('createOrder'), "是否支持2.0js-api");
  646. // if (tt.canIUse('createOrder')) {
  647. // //支持 支付2.0 js-api
  648. // let tempCallbackData = {}
  649. // tempCallbackData[that.data.data.couponChannel.ttSpuId] = that.data.data.couponChannel.id
  650. // let options = {
  651. // callbackData: tempCallbackData,
  652. // goodsList: [
  653. // {
  654. // quantity: 1, // 购买数量 必填
  655. // price: that.data.priceAndStockObj.salePrice, // 商品价格 必填
  656. // goodsName: that.data.data.title, // 商品名称 必填
  657. // goodsPhoto: that.data.data.coverImg, // 商品图片链接 必填
  658. // goodsId: that.data.data.couponChannel.ttSpuId, // 商品ID 必填
  659. // goodsType: 1, // 商品类型 必填
  660. // goodsLabels: ['过期退', '随时退', '免预约'], // 商品标签 非必填
  661. // dateRule: '', // 使用规则 非必填
  662. // },
  663. // ],
  664. // payment: {
  665. // totalAmount: that.data.priceAndStockObj.salePrice, // 订单总价 必填
  666. // },
  667. // success: res => {
  668. // tt.hideLoading();
  669. // that.setData({
  670. // showbutton: false,
  671. // })
  672. // const { orderId, outOrderNo } = res;
  673. // that.setData({ orderId, outOrderNo });
  674. // that.payOrderUpdate(outOrderNo, outOrderNo, 1, '', '', that, '');
  675. // },
  676. // fail: res => {
  677. // const { orderId, outOrderNo, errNo, errMsg, errLogId } = res;
  678. // if (errLogId) {
  679. // tt.hideLoading();
  680. // that.setData({
  681. // showbutton: false,
  682. // })
  683. // console.log('预下单失败', errNo, errMsg, errLogId);
  684. // let tempErrmsg = errMsg.split('开发者拒绝交易:');
  685. // tt.showToast({
  686. // title: tempErrmsg[tempErrmsg.length - 1],
  687. // icon: 'none',
  688. // duration: 2000,
  689. // mask: false
  690. // });
  691. // }
  692. // if (orderId || outOrderNo) {
  693. // tt.hideLoading();
  694. // that.setData({
  695. // showbutton: false,
  696. // })
  697. // console.log('支付失败', errNo, errMsg, orderId, outOrderNo);
  698. // console.log(that.payOrderUpdate, "payOrderUpdate");
  699. // tt.showToast({
  700. // title: "取消支付",
  701. // icon: 'none',
  702. // duration: 2000,
  703. // mask: false
  704. // });
  705. // that.payOrderUpdate(outOrderNo, outOrderNo, 2, '', 'fail')
  706. // }
  707. // },
  708. // }
  709. // console.log(options, "options");
  710. // tt.createOrder(options)
  711. // } else {
  712. // //不支持 支付2.0 js -api
  713. // }
  714. // }
  715. }).catch(err => {
  716. tt.hideLoading()
  717. that.setData({
  718. showbutton: false,
  719. })
  720. if (err.code == 2011) {
  721. tt.showToast({
  722. title: "商户信息没找到",
  723. image: './../../../assets/images/fail.png',
  724. duration: 2000,
  725. mask: false
  726. });
  727. } else if (err.code == 2013) {
  728. tt.showToast({
  729. title: "商户信息禁用",
  730. image: './../../../assets/images/fail.png',
  731. duration: 2000,
  732. mask: false
  733. });
  734. } else if (err.code == 3000) {
  735. tt.showToast({
  736. title: "库存不足",
  737. image: './../../../assets/images/fail.png',
  738. duration: 2000,
  739. mask: false
  740. });
  741. } else if (err.code == 3001) {
  742. tt.showToast({
  743. title: "您已超过限购",
  744. image: './../../../assets/images/fail.png',
  745. duration: 2000,
  746. mask: false
  747. });
  748. } else if (err.code == 3002) {
  749. tt.showToast({
  750. title: "订单失败",
  751. image: './../../../assets/images/fail.png',
  752. duration: 2000,
  753. mask: false
  754. });
  755. } else if (err.code == 3003) {
  756. tt.showToast({
  757. title: "订单不存在",
  758. image: './../../../assets/images/fail.png',
  759. duration: 2000,
  760. mask: false
  761. });
  762. } else if (err.code == 3004) {
  763. tt.showToast({
  764. title: "订单不存在",
  765. image: './../../../assets/images/fail.png',
  766. duration: 2000,
  767. mask: false
  768. });
  769. } else if (err.code == 4003) {
  770. tt.showToast({
  771. title: "卡券已作废",
  772. image: './../../../assets/images/fail.png',
  773. duration: 2000,
  774. mask: false
  775. });
  776. } else if (err.code == 3012) {
  777. that.getUnPaidOrder(that.data.couponId);
  778. } else if (err.code == 11005) {
  779. /**
  780. * 将值传到用户手机号授权的页面
  781. *
  782. */
  783. tt.navigateTo({
  784. url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr`
  785. });
  786. } else if (err.code == 11006) {
  787. // 用户手机已加密
  788. tt.navigateTo({
  789. url: `/pages/getPhone/getPhone?couponChannelId=${that.data.couponChannelId}&path=qr`
  790. });
  791. } else {
  792. tt.showToast({
  793. title: err.message,
  794. icon: 'none',
  795. duration: 2000,
  796. mask: false
  797. });
  798. }
  799. })
  800. }).catch(err => {
  801. tt.hideLoading()
  802. that.setData({
  803. showbutton: false,
  804. })
  805. console.log(err)
  806. if (err.code == 11004) {
  807. tt.navigateTo({
  808. url: `/pages/getuserinfo/getuserinfo?fromflag=confirmation&confirmationFlag=${that.data.couponChannelId}`,
  809. })
  810. } else {
  811. tt.showToast({
  812. title: err.message,
  813. icon: "none",
  814. duration: 2500
  815. })
  816. }
  817. })
  818. },
  819. })