多租户商城-商户小程序端
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.

209 lines
5.6 KiB

2 years ago
2 years ago
2 years ago
  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. this.jumpInteractionDiagramDetail(linkObj.data)
  43. break
  44. case '自定义':
  45. // router.push("/category");
  46. case '公告':
  47. this.jumpNoticeDetail(linkObj.data)
  48. break
  49. }
  50. } else if(linkObj.selsectValue==='/index'){
  51. uni.navigateTo({
  52. url: `/pages/index/index`
  53. })
  54. }
  55. return link
  56. },
  57. // 跳转到类别主页
  58. jumpCategory(item){
  59. uni.navigateTo({
  60. url: `/pages_category_page1/goodsModule/goodsList?category3Id=${item.id}`
  61. })
  62. },
  63. // 跳转到产品列表
  64. jumpProList(item){
  65. if(item.sourceType === '1'){
  66. uni.navigateTo({
  67. url: `/pages_category_page1/goodsModule/canvasGoods?sourceType=${item.sourceType}&ids=${item.productIdList}`
  68. })
  69. } else if(item.sourceType === '2'){
  70. uni.navigateTo({
  71. url: `/pages_category_page1/goodsModule/canvasGoods?sourceType=${item.sourceType}&classifyId=${item.categoryId}`
  72. })
  73. }
  74. },
  75. // 跳转到店铺主页
  76. jumpStore(item){
  77. uni.navigateTo({
  78. url: `/pages_category_page1/store/index?storeId=${item.shopId}`
  79. })
  80. },
  81. // 跳转到商品详情
  82. jumpProductDetail(item){
  83. uni.navigateTo({
  84. url: '/pages_category_page1/goodsModule/goodsDetails?shopId=' + item.shopId + '&productId=' + item.productId + '&skuId=' + item
  85. .skuId
  86. })
  87. },
  88. jumpInteractionDiagramDetail(item){
  89. uni.navigateTo({
  90. url: '/pages_category_page1/goodsModule/interactionDiagramDetail?interactionDiagramId=' + item.interactionDiagramId
  91. })
  92. },
  93. // 跳转到秒杀专区
  94. jumpSeckills(item){
  95. if(item.shopId){
  96. uni.navigateTo({
  97. url: '/pages_category_page1/discount/spikeList?shopId=' + item.shopId + '&shopSeckillId=' + item.shopSeckillId
  98. })
  99. } else {
  100. uni.navigateTo({
  101. url: '/pages_category_page1/discount/spikeList'
  102. })
  103. }
  104. },
  105. // 跳转到拼团专区
  106. jumpGroupWorks(item){
  107. if(item.shopId){
  108. uni.navigateTo({
  109. url: '/pages_category_page1/discount/groupBuy?shopId=' + item.shopId + '&shopGroupWorkId=' + item.shopGroupWorkId
  110. })
  111. } else {
  112. uni.navigateTo({
  113. url: '/pages_category_page1/discount/groupBuy?'
  114. })
  115. }
  116. },
  117. // 跳转到折扣专区
  118. jumpDiscount(item){
  119. if(item.shopId){
  120. if (item.shopDiscountId) {
  121. uni.navigateTo({
  122. url: '/pages_category_page1/discount/discount?shopId=' + item.shopId + '&shopDiscountId=' + item.shopDiscountId
  123. })
  124. } else {
  125. uni.showToast({
  126. title: '暂无活动',
  127. icon: "none"
  128. });
  129. }
  130. } else {
  131. if (item.discountId) {
  132. uni.navigateTo({
  133. url: '/pages_category_page1/discount/platformDiscount?discountId=' + item.discountId
  134. })
  135. } else {
  136. uni.showToast({
  137. title: '暂无活动',
  138. icon: "none"
  139. });
  140. }
  141. }
  142. },
  143. // 跳转到会员专区
  144. jumpVip(){
  145. uni.navigateTo({
  146. url: '/pages_category_page1/memberCenter/activityList',
  147. success: res => {},fail: () => {},complete: () => {}
  148. })
  149. },
  150. // 跳转组合支付
  151. jumpCombination(item){
  152. if (item.priceId) {
  153. uni.navigateTo({
  154. url: '/pages_category_page1/goodsModule/combination?priceId=' + item.priceId
  155. })
  156. } else {
  157. uni.showToast({
  158. title: '暂无活动',
  159. icon: "none"
  160. });
  161. }
  162. },
  163. // 跳转到公告详情
  164. jumpNoticeDetail(item){
  165. uni.navigateTo({
  166. url: '/pages_category_page2/userModule/messageDetail?noticeId=' + item.noticeId
  167. })
  168. },
  169. // 跳转到直播列表
  170. jumpLive(){
  171. uni.navigateTo({
  172. url: '/pages_category_page2/livePage/index'
  173. })
  174. },
  175. // 领取优惠券
  176. // receiveCoupon(item) {
  177. // var key = canvasConfig.getToken()
  178. // if (key) {
  179. // var paramsData = {}
  180. // if(this.typeId === 1){
  181. // paramsData.couponId = item.couponId
  182. // } else if(this.typeId === 3) {
  183. // paramsData.shopCouponId = item.shopCouponId
  184. // paramsData.shopId = this.shopId
  185. // }
  186. // let params = {
  187. // url: api.takeCoupon,
  188. // method: 'POST',
  189. // data: paramsData
  190. // }
  191. // this.sendReq(params, (res) => {
  192. // this.$message({
  193. // message: '领取成功!',
  194. // type: 'success'
  195. // })
  196. // this.getData()
  197. // })
  198. // } else {
  199. // this.$message({
  200. // message: '请先登录'
  201. // })
  202. // this.$router.push({path: '/login'})
  203. // }
  204. // },
  205. // 加入购物车
  206. addCart(id){
  207. }
  208. }
  209. }