123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172 |
- import {
- get
- } from "../../../utils/http"
- Page({
-
- data: {
- groupGoodsDetail: '',
- store_id: "",
- page: 1,
- limit: 3,
- total: '',
- checkGrouping: '',
- groupStatus: '',
- self: false,
- group_id: "",
- total: '',
- swiperPage: 1,
- groupingList: '',
- source:'',
- },
-
- onLoad(options) {
-
- let self = false
- if (options.self) {
- self = true
- }
- this.setData({
- store_id: wx.getStorageSync('store_id'),
- groupStatus: options.groupStatus,
- self,
- group_id: options.group_id,
- })
-
- this.getCheckGrouping()
-
- this.getGroupGoodsDetail()
- },
-
- onReady() {
- },
-
- onShow() {
- },
-
- onHide() {
- },
-
- onUnload() {
- },
-
- onPullDownRefresh() {
- },
-
- onReachBottom() {
- },
-
- onShareAppMessage() {
- },
-
- getGroupGoodsDetail() {
- get('v2/api/grouping/info', {
- id: this.data.group_id,
- store_id: this.data.store_id || wx.getStorageSync('store_id')
- }, (res) => {
- if (res.code == 200) {
- this.setData({
- groupGoodsDetail: res.data,
- source: res.data.goods_type == 1 ? 'goods' : 'secondaryCard'
- })
- this.getGroupingList()
- }
- })
- },
-
- getGroupingList(_page) {
- get('v2/api/grouping/grouping', {
- id: this.data.groupGoodsDetail.id,
- store_id: this.data.store_id || wx.getStorageSync('store_id'),
- page: _page || this.data.page,
- limit: this.data.limit
- }, (res) => {
- if (res.code == 200) {
- this.setData({
- groupingList: res.data.list,
- total: res.data.total
- })
- if (res.data.total > 3) {
- let swiperPage = Math.ceil(res.data.total / 3)
- this.setData({
- swiperPage
- })
- }
- }
- })
- },
-
- getCheckGrouping() {
- get('v2/api/grouping/check', {}, (res) => {
- this.setData({
-
- checkGrouping: res.data.status
- })
- })
- },
-
- swiperChange(e) {
- let index = e.detail.current
- this.getGroupingList(index + 1)
- },
-
- goGrouping(e) {
- let grouping_id = e.currentTarget.dataset.grouping_id
-
-
-
-
-
-
-
- wx.navigateTo({
- url: `/subPackagesB/pages/GroupConfirm/GroupConfirm?store_id=${this.data.store_id}&&productId=${this.data.groupGoodsDetail.goods_id}&&source=${this.data.source}&&groupPrice=${this.data.groupGoodsDetail.price}&&isGrouping=true&&original_price=${this.data.groupGoodsDetail.original_price}&&groupID=${this.data.groupGoodsDetail.id}&&isSuccess=true&&grouping_id=${grouping_id}`,
- })
- },
-
- toGoodsOrderConfrim() {
- wx.navigateTo({
- url: `/subPackagesB/pages/GroupConfirm/GroupConfirm?store_id=${this.data.store_id}&&productId=${this.data.groupGoodsDetail.goods_id}&&source=${this.data.source}&&groupPrice=${this.data.groupGoodsDetail.original_price}&&isGrouping=false`,
- })
- },
-
- toGroupOrderConfrim() {
- wx.navigateTo({
- url: `/subPackagesB/pages/GroupConfirm/GroupConfirm?store_id=${this.data.store_id}&&productId=${this.data.groupGoodsDetail.goods_id}&&source=${this.data.source}&&groupPrice=${this.data.groupGoodsDetail.price}&&isGrouping=true&&original_price=${this.data.groupGoodsDetail.original_price}&&groupID=${this.data.groupGoodsDetail.id}`,
- })
- }
- })
|