C端小程序
Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

252 Zeilen
8.3 KiB

  1. var config = require("../../config/config.js");
  2. var app = getApp();
  3. const Http = require("../../utils/HttpBasics");
  4. Page({
  5. data: {
  6. canIUse: wx.canIUse("button.open-type.getUserInfo"),
  7. path:null,
  8. couponChannelId: null,
  9. cuserId:null,
  10. coverImg:null,
  11. couponOrderId:null,
  12. optionData:null
  13. },
  14. onLoad: function(options) {
  15. var that = this;
  16. if (options.couponChannelId && !options.cuserId||options.orderId) {
  17. that.setData({
  18. couponChannelId: options.couponChannelId,
  19. orderId:options.orderId
  20. })
  21. }
  22. this.setData({
  23. optionData:options
  24. })
  25. if (options&&options.path == 'index') {
  26. that.setData({
  27. path: options.path
  28. })
  29. }
  30. /**
  31. * 来自转赠
  32. */
  33. if (options.couponChannelId && options.cuserId){
  34. console.log(1231231231,options)
  35. that.setData({
  36. couponChannelId: options.couponChannelId,
  37. cuserId: options.cuserId,
  38. coverImg: options.coverImg,
  39. userName: options.userName,
  40. avatarUrl: options.avatarUrl,
  41. couponOrderId: options.couponOrderId
  42. })
  43. }
  44. Http.get({
  45. url: config.api.marketicon,
  46. data: {
  47. appId: config.weapp.AppId
  48. }
  49. }).then(res => {
  50. that.setData({
  51. mallImgUrl: res.data.mallImgUrl
  52. });
  53. wx.setNavigationBarTitle({
  54. title: res.data.mallName
  55. })
  56. })
  57. .catch(err => {
  58. wx.showToast({
  59. title: err.errMsg,
  60. icon: 'none',
  61. duration: 2000,
  62. mask: false
  63. });
  64. })
  65. },
  66. bindGetUserInfo: function (e) {
  67. let that = this;
  68. var iv = e.detail.iv;
  69. var encryptedData = e.detail.encryptedData;
  70. Http.post({
  71. url: config.api.getUserInfo,
  72. data: {
  73. encryptedData: encryptedData,
  74. iv: iv
  75. }
  76. })
  77. .then(
  78. function (res) {
  79. console.log(res, that.data,6666666666)
  80. // console.log(options && options.id && app.globalData.type == 'td',55555)
  81. if (that.data.optionData.orderGroupId){
  82. wx.reLaunch({
  83. url: `/pages/joinFrDpell/index?couponId=${that.data.optionData.couponId}&orderGroupId=${that.data.optionData.orderGroupId}&couponChannelId=${that.data.optionData.couponChannelId}&orderId=${that.data.optionData.orderId}&avatarUrl=${that.data.optionData.avatarUrl}&nickName=${that.data.optionData.nickName}`
  84. });
  85. return;
  86. }
  87. if (that.data.path == 'index') {
  88. wx.reLaunch({
  89. url: "/pages/game/index"
  90. });
  91. } else {
  92. //返回主页
  93. if (that.data.couponChannelId && !that.data.cuserId&&app.globalData.type == 'cd') {
  94. // 跳转普通券/消费卡/限时秒杀/砍价详情
  95. wx.navigateTo({
  96. url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}}`
  97. });
  98. } else if (that.data.couponChannelId && that.data.cuserId) {
  99. // 来自转赠
  100. wx.reLaunch({
  101. url: `/pages/coupon/detail/index?couponChannelId=${that.data.couponChannelId}&cuserId=${that.data.cuserId}&coverImg=${that.data.coverImg}&userName=${that.data.userName}&avatarUrl=${that.data.avatarUrl}&couponOrderId=${that.data.couponOrderId}&updateDate=${that.data.updateDate}`
  102. });
  103. } else if (that.data.couponChannelId && app.globalData.type == 'sd') {
  104. // 拼团详情页
  105. wx.redirectTo({
  106. url: `/pages/spellGroup/mySpellGroup/index?couponChannelId=${that.data.couponChannelId}`,
  107. })
  108. } else if (that.data.optionData.id && app.globalData.type == 'gm') {
  109. // 游戏页面
  110. that.getGameOne(app.globalData.token, that.data.optionData.id)
  111. } else if (that.data.optionData.bt && that.data.optionData.id && app.globalData.type == 'bd') {
  112. // 宣传页详情
  113. if (that.data.optionData.bt == '2') {
  114. // 自由图文
  115. wx.redirectTo({
  116. url: `/pages/freeBannerDetail/index?id=${that.data.optionData.id}`,
  117. })
  118. } else {
  119. // 标准格式
  120. wx.redirectTo({
  121. url: `/pages/bannerdetail/index?id=${that.data.optionData.id}`,
  122. })
  123. }
  124. } else if (that.data.orderId&&app.globalData.type=='bg') {
  125. // 参与砍价
  126. wx.navigateTo({
  127. url: `/pages/bargain/bargainDatail/bargainDatail?orderId=${that.data.orderId}`
  128. });
  129. } else if (app.globalData.type == 'uc') {
  130. // 我的
  131. wx.switchTab({
  132. url: '/pages/user/index'
  133. });
  134. } else if (app.globalData.type == 'pc') {
  135. // 停车
  136. wx.switchTab({
  137. url: '/pages/passCar/passCar'
  138. });
  139. } else if (app.globalData.type == 'mc') {
  140. // 我的券包
  141. wx.redirectTo({
  142. url: '/pages/couponorder/index/index'
  143. });
  144. } else if (app.globalData.type == 'mo') {
  145. // 我的订单
  146. wx.redirectTo({
  147. url: '/pages/order/index/index?id=all'
  148. });
  149. } else if (app.globalData.type == 'ca') {
  150. // 我的卡包
  151. wx.redirectTo({
  152. url: '/pages/cardorder/index/index'
  153. });
  154. } else if (app.globalData.type == 'sc') {
  155. // 特享礼遇
  156. wx.redirectTo({
  157. url: '/pages/specialcourtesy/specialcourtesy'
  158. });
  159. } else if (app.globalData.type == 'rb') {
  160. // 限时秒杀
  161. wx.redirectTo({
  162. url: '/pages/rushToBuy/index'
  163. });
  164. } else if (app.globalData.type == 'bl') {
  165. // 砍价专场
  166. wx.redirectTo({
  167. url: '/pages/bargain/bargain'
  168. });
  169. } else if (app.globalData.type == 'mb') {
  170. // 我的砍价
  171. wx.redirectTo({
  172. url: '/pages/bargain/bargain?from=myhtml'
  173. });
  174. } else if (app.globalData.type == 'sl') {
  175. // 拼团专场
  176. wx.redirectTo({
  177. url: '/pages/spellGroup/spellGroup'
  178. });
  179. } else if (app.globalData.type == 'ms') {
  180. // 我的拼团
  181. wx.redirectTo({
  182. url: '/pages/spellGroup/spellGroup?from=myhtml'
  183. });
  184. } else if (app.globalData.type == 'dc') {
  185. // 消费卡
  186. wx.redirectTo({
  187. url: '/pages/discountCardList/discountCardList'
  188. });
  189. } else if (app.globalData.type == 'td') {
  190. // 专题活动页
  191. wx.redirectTo({
  192. url: '/pages/topicDetail/index'
  193. });
  194. }
  195. /**
  196. * options有问题
  197. */
  198. // else if (options && options.id && app.globalData.type == 'td') {
  199. // // 专题活动页
  200. // wx.redirectTo({
  201. // url: '/pages/topicDetail/index'
  202. // });
  203. // }
  204. else if (app.globalData.type == 'ml') {
  205. // 门店
  206. wx.switchTab({
  207. url: '/pages/index/searchbar/index'
  208. });
  209. } else {
  210. wx.switchTab({
  211. url: "/pages/main/index"
  212. });
  213. }
  214. }
  215. },
  216. function (error) {
  217. console.log(error)
  218. wx.showToast({
  219. title: "请授权个人信息",
  220. icon: "none"
  221. });
  222. }
  223. )
  224. .catch(err => {
  225. wx.showToast({
  226. title: err.errMsg,
  227. icon: 'none',
  228. duration: 2000,
  229. mask: false
  230. });
  231. })
  232. },
  233. getGameOne: function (token, id) {
  234. let _this = this;
  235. Http.get({
  236. url: config.api.getOneGame,
  237. data: {
  238. token: token,
  239. id: id
  240. }
  241. }).then(res => {
  242. wx.redirectTo({
  243. url: '/pages/game/index?url=' + res.data.url + "&id=" + res.data.id + "&gameId=" + res.data.gameId,
  244. })
  245. })
  246. .catch(err => {
  247. this.alphaClick();
  248. })
  249. },
  250. });