funMixin.js 4.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203
  1. // import router from '@/router'
  2. import api from '../api'
  3. import { sendReq } from './sendReqMixin'
  4. import { mapMutations } from 'vuex'
  5. import canvasConfig from '../config'
  6. /*
  7. * 公共方法的 mixin
  8. */
  9. export const tool = {
  10. mixins: [ sendReq ],
  11. props: {
  12. isNoData: {
  13. type: Boolean,
  14. default: false
  15. },
  16. comType: {
  17. type: String,
  18. default: ''
  19. }
  20. },
  21. mounted() {
  22. },
  23. methods: {
  24. ...mapMutations({
  25. setCurrentPro: 'SET_CURRENTPRO'
  26. }),
  27. // 判断url
  28. jumpLink(linkObj) {
  29. var link = ''
  30. if (linkObj && linkObj.typeText && linkObj.data) {
  31. switch (linkObj.typeText) {
  32. case '类别':
  33. this.jumpCategory(linkObj.data)
  34. break
  35. case '店辅':
  36. this.jumpStore(linkObj.data)
  37. break
  38. case '商品':
  39. this.jumpProductDetail(linkObj.data)
  40. break
  41. case '自定义':
  42. // router.push("/category");
  43. case '公告':
  44. this.jumpNoticeDetail(linkObj.data)
  45. break
  46. }
  47. } else if (linkObj.selsectValue === '/index') {
  48. uni.navigateTo({
  49. url: `/pages/another-index/index`
  50. })
  51. }
  52. return link
  53. },
  54. // 跳转到类别主页
  55. jumpCategory(item) {
  56. uni.navigateTo({
  57. url: `/another-tf/another-serve/goodsList/index?classifyId=${item.id}`
  58. })
  59. },
  60. // 跳转到产品列表
  61. jumpProList(item) {
  62. if (item.sourceType === '1') {
  63. uni.navigateTo({
  64. url: `/another-tf/another-serve/canvasGoods/index?sourceType=${item.sourceType}&ids=${item.productIdList}`
  65. })
  66. } else if (item.sourceType === '2') {
  67. uni.navigateTo({
  68. url: `/another-tf/another-serve/canvasGoods/index?sourceType=${item.sourceType}&classifyId=${item.categoryId}`
  69. })
  70. }
  71. },
  72. // 跳转到店铺主页
  73. jumpStore(item) {
  74. uni.navigateTo({
  75. url: `/another-tf/another-user/shop/shop-detail?shopId=${item.shopId}`
  76. })
  77. },
  78. // 跳转到商品详情
  79. jumpProductDetail(item) {
  80. uni.navigateTo({
  81. url: '/another-tf/another-serve/goodsDetails/index?shopId=' + item.shopId + '&productId=' + item.productId + '&skuId=' + item
  82. .skuId
  83. })
  84. },
  85. // 跳转到秒杀专区
  86. jumpSeckills(item) {
  87. if (item.shopId) {
  88. uni.navigateTo({
  89. url: '/another-tf/another-serve/discount/spikeList?shopId=' + item.shopId + '&shopSeckillId=' + item.shopSeckillId
  90. })
  91. } else {
  92. uni.navigateTo({
  93. url: '/another-tf/another-serve/discount/spikeList'
  94. })
  95. }
  96. },
  97. // 跳转到拼团专区
  98. jumpGroupWorks(item) {
  99. if (item.shopId) {
  100. uni.navigateTo({
  101. url: '/another-tf/another-serve/discount/groupBuy?shopId=' + item.shopId + '&shopGroupWorkId=' + item.shopGroupWorkId
  102. })
  103. } else {
  104. uni.navigateTo({
  105. url: '/another-tf/another-serve/discount/groupBuy?'
  106. })
  107. }
  108. },
  109. // 跳转到折扣专区
  110. jumpDiscount(item) {
  111. if (item.shopId) {
  112. if (item.shopDiscountId) {
  113. uni.navigateTo({
  114. url: '/another-tf/another-serve/discount/discount?shopId=' + item.shopId + '&shopDiscountId=' + item.shopDiscountId
  115. })
  116. } else {
  117. uni.showToast({
  118. title: '暂无活动',
  119. icon: 'none'
  120. })
  121. }
  122. } else if (item.discountId) {
  123. uni.navigateTo({
  124. url: '/another-tf/another-serve/discount/platformDiscount?discountId=' + item.discountId
  125. })
  126. } else {
  127. uni.showToast({
  128. title: '暂无活动',
  129. icon: 'none'
  130. })
  131. }
  132. },
  133. // 跳转到会员专区
  134. jumpVip() {
  135. uni.navigateTo({
  136. url: '/another-tf/another-serve/memberCenter/activityList',
  137. success: (res) => {},
  138. fail: () => {},
  139. complete: () => {}
  140. })
  141. },
  142. // 跳转组合支付
  143. jumpCombination(item) {
  144. if (item.priceId) {
  145. uni.navigateTo({
  146. url: '/another-tf/another-serve/combination/index?priceId=' + item.priceId
  147. })
  148. } else {
  149. uni.showToast({
  150. title: '暂无活动',
  151. icon: 'none'
  152. })
  153. }
  154. },
  155. // 跳转到公告详情
  156. jumpNoticeDetail(item) {
  157. uni.navigateTo({
  158. url: '/another-tf/another-serve/messageDetail/index?noticeId=' + item.noticeId
  159. })
  160. },
  161. // 跳转到直播列表
  162. jumpLive() {
  163. uni.navigateTo({
  164. url: '/another-tf/another-serve/livePage/index'
  165. })
  166. },
  167. // 领取优惠券
  168. // receiveCoupon(item) {
  169. // var key = canvasConfig.getToken()
  170. // if (key) {
  171. // var paramsData = {}
  172. // if(this.typeId === 1){
  173. // paramsData.couponId = item.couponId
  174. // } else if(this.typeId === 3) {
  175. // paramsData.shopCouponId = item.shopCouponId
  176. // paramsData.shopId = this.shopId
  177. // }
  178. // let params = {
  179. // url: api.takeCoupon,
  180. // method: 'POST',
  181. // data: paramsData
  182. // }
  183. // this.sendReq(params, (res) => {
  184. // this.$message({
  185. // message: '领取成功!',
  186. // type: 'success'
  187. // })
  188. // this.getData()
  189. // })
  190. // } else {
  191. // this.$message({
  192. // message: '请先登录'
  193. // })
  194. // this.$router.push({path: '/login'})
  195. // }
  196. // },
  197. // 加入购物车
  198. addCart(id) {
  199. }
  200. }
  201. }