123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125 |
- import {
- get,
- post
- } from "../../../utils/http"
- // subPackagesB/pages/groupOrder/groupOrder.js
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- GroupOrderList: '', //拼团记录详情
- userGroupId: '', //用户拼团ID
- store_id: '', //店铺ID
- original_price: '', //原价
- goods_id: '', //商品ID
- source: '', //商品类型
- grouping_id: '', //拼团记录ID
- groupID: '', //拼团活动ID
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- console.log(options);
- this.setData({
- store_id: wx.getStorageSync('store_id'),
- goods_id: options.goods_id,
- original_price: options.original_price,
- source: options.source,
- grouping_id: options.grouping_id,
- groupID: options.groupID
- })
- // 获取拼团记录详情
- this.getGroupOrderDetail()
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage(res) {
- if (res.from == 'button') {
- console.log(res.target, res)
- }
- return {
- title: this.data.GroupOrderList.share_text, //分享内容标题
- path: `/subPackagesB/pages/groupDetail/groupDetail?isShare=true&&id=${this.data.groupID}&&grouping_id=${this.data.grouping_id}`, //这里是被分享的人点击进来之后的页面
- imageUrl: this.data.GroupOrderList.share_image //这里是图片的路径
- }
- },
- // 获取拼团记录详情
- getGroupOrderDetail() {
- get('v2/api/grouping/log_info', {
- id: this.data.grouping_id
- }, (res) => {
- if (res.code == 200) {
- console.log(res);
- this.setData({
- GroupOrderList: res.data,
- userGroupId: res.data.id
- })
- }
- })
- },
- // 取消拼团
- cancelGroup() {
- let that = this
- post('v2/api/grouping/cancel', {
- id: that.data.grouping_id
- }, (res) => {
- wx.showToast({
- title: '取消成功',
- success: setTimeout(function () {
- wx.redirectTo({
- url: `/subPackagesB/pages/GroupConfirm/GroupConfirm?store_id=${that.data.store_id}&&productId=${that.data.goods_id}&&source=${that.data.source}&&groupPrice=${that.data.original_price}&&isGrouping=false`,
- })
- },2000)
- })
- })
- }
- })
|