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

204 lines
5.5 KiB

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