123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168 |
- // pages/orderDetailsProject/orderDetailsProject.js
- import {
- get,
- post
- } from '../../utils/http'
- import {
- trackUserEvent
- } from '../../utils/util'
- const app = getApp()
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- orderDetailsId: '',
- orderDetails: '',
- storeDataid: ''
- },
- onCopy: function (e) {
- let content = e.currentTarget.dataset.no
- var that = this;
- wx.setClipboardData({
- data: content,
- success: function (res) {
- wx.showToast({
- title: '复制成功!',
- icon: "none"
- })
- }
- });
- },
- /**
- * 取消订单
- */
- btmBack(e) {
- let that = this
- wx.showModal({
- title: '提示',
- content: '是否申请退款',
- success(res) {
- if (res.confirm) {
- console.log('用户点击确定')
- post(
- 'v2/api/order/cancel', {
- id: that.data.orderDetails.id
- },
- (res) => {
- wx.showToast({
- title: res.msg,
- icon: 'success',
- duration: 2000
- })
- that.getOrderData()
- }
- )
- } else if (res.cancel) {
- console.log('用户点击取消')
- }
- }
- })
- },
- /**
- * 获取订单详情
- */
- async getOrderData() {
- let resp = await get('v2/api/order/info', { id: this.data.orderDetailsId })
- if (resp.code === 200) {
- this.setData({
- orderDetails: resp.data
- })
- }
- },
- /**
- * 获取订单详情
- */
- productRecommend() {
- get('v2/api/product/recommend', {
- store_id:this.data.storeDataid,
- page: 1,
- limit:10
- }, (res) => {
- this.setData({
- productRecommend: res.data.list
- }, )
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad: async function (options) {
- this.setData({
- orderDetailsId: options.id
- })
- await this.getOrderData()
- let storeDataid = this.data.orderDetails.store_id
- let lat1 = app.address.latitude
- let lng1 = app.address.longitude
- this.setData({
- storeDataid:storeDataid,
- lat1: lat1,
- lng1: lng1,
- })
- this.productRecommend()
- if (options.click) {
- trackUserEvent(options.click)
- }
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady: function () {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow: function () {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide: function () {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload: function () {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh: function () {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom: function () {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage: function () {
- }
- })
|