order.js 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788
  1. const App = getApp();
  2. // 枚举类:发货方式
  3. const DeliveryTypeEnum = require('../../../utils/enum/DeliveryType.js');
  4. Page({
  5. /**
  6. * 页面的初始数据
  7. */
  8. data: {
  9. // 当前页面参数
  10. options: {},
  11. // 配送方式
  12. deliverys: DeliveryTypeEnum,
  13. },
  14. /**
  15. * 生命周期函数--监听页面加载
  16. */
  17. onLoad(options) {
  18. let _this = this,
  19. scene = App.getSceneData(options);
  20. // 记录options
  21. _this.setData({
  22. options: scene
  23. });
  24. // 获取订单详情
  25. _this.getOrderDetail();
  26. },
  27. /**
  28. * 获取订单详情
  29. */
  30. getOrderDetail() {
  31. let _this = this;
  32. App._get('shop.order/detail', {
  33. order_id: _this.data.options.oid,
  34. order_type: _this.data.options.oty
  35. }, result => {
  36. _this.setData(result.data);
  37. });
  38. },
  39. /**
  40. * 跳转到商品详情
  41. */
  42. onTargetGoods(e) {
  43. let goods_id = e.currentTarget.dataset.id;
  44. wx.navigateTo({
  45. url: '../../goods/index?goods_id=' + goods_id
  46. });
  47. },
  48. /**
  49. * 跳转到门店详情
  50. */
  51. onTargetShop(e) {
  52. wx.navigateTo({
  53. url: '../../shop/detail/index?shop_id=' + e.currentTarget.dataset.id,
  54. })
  55. },
  56. /**
  57. * 确认核销
  58. */
  59. onSubmitExtract() {
  60. let _this = this;
  61. wx.showModal({
  62. title: "提示",
  63. content: "确认核销该订单吗?",
  64. success(o) {
  65. if (o.confirm) {
  66. App._post_form('shop.order/extract', {
  67. order_id: _this.data.options.oid,
  68. order_type: _this.data.options.oty
  69. }, result => {
  70. App.showSuccess(result.msg, () => {
  71. // 获取订单详情
  72. _this.getOrderDetail();
  73. });
  74. });
  75. }
  76. }
  77. });
  78. },
  79. })