| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139 |
- // pages/orderDetail/orderDetail.js
- const app = getApp()
- import http from "../../utils/http"
- import util from "../../utils/util"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- info: '',
- settle: '',
- safeBottom: `30px`,
- },
- allocation(){
- util.skip('/pages/allocation/allocation?id='+this.data.info.id)
- },
- accept(){
- wx.requestSubscribeMessage({
- tmplIds: [app.globalData.templateconfig.shop_order_template,app.globalData.templateconfig.shop_finish_template,app.globalData.templateconfig.shop_sales_template],
- complete :(res) =>{
- http.post('order/shopaccept', {
- id: this.data.info.id
- }, true, false).then(res => {
- util.toast('抢单成功,请派单')
- this.getInfo()
- }).catch(e => {
- let data = e.data
- if(data.code === 2){
- util.toast(data.msg)
- setTimeout(()=>{
- util.skip('/service/earnestMoney/earnestMoney')
- },1000)
- }else if(data.code === 0){
- util.toast(data.data)
- }
- })
- }
- })
-
- },
- copy(event){
- wx.setClipboardData({
- data: event.currentTarget.dataset.content,
- success (res) {
- util.toast('已复制')
- }
- })
- },
- navigation(){
- wx.openLocation({
- latitude : Number(this.data.info.orderAddress.lat),
- longitude : Number(this.data.info.orderAddress.lng),
- name: this.data.info.orderAddress.area,
- scale: 18
- })
- },
- call(event){
- wx.makePhoneCall({
- phoneNumber: event.currentTarget.dataset.content
- })
- },
- getInfo(){
- http.post('order/orderInfo', {
- id: this.data.order_id
- }).then(res => {
- this.setData({
- info: res.data
- })
- if(res.data.is_settle > 0 ){
- this.getSettle()
- }
- })
- },
- getSettle(){
- http.post('order/priceInfo', {
- id: this.data.order_id
- }).then(res => {
- this.setData({
- settle: res.data
- })
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- const high = app.globalData.safeBottom
- this.setData({
- safeBottom: `${high}px`,
- order_id: options.order_id
- })
-
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- this.getInfo()
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|