| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140 |
- // pages/allocation/allocation.js
- const app = getApp()
- import http from "../../utils/http"
- import util from "../../utils/util"
- Page({
- /**
- * 页面的初始数据
- */
- data: {
- id: '',
- skill_id:'',
- popupOrder:false,
- list:[],
- finish: false,
- loading: false,
- page: 1,
- order: [],
- safeBottom: `30px`,
- },
- sure(){
- if(this.data.skill_id === '') return util.toast('请先选择服务者')
- http.post('shop/allocationorder', {
- id: this.data.id,
- skill_id: this.data.skill_id
- }, true, false).then(res => {
- util.toast('分配成功')
- setTimeout(()=>{
- util.back()
- },1000)
- }).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.msg)
- }
- })
- },
-
- getList(){
-
- let data = {
- page: this.data.page,
- id: this.data.id
- }
- http.post('shop/getshopskill', data).then(res => {
-
- let arr = this.data.list.concat(res.data)
- this.setData({
- list: arr,
- finish: true
- })
-
- })
- },
- /**
- * 生命周期函数--监听页面加载
- */
- onLoad(options) {
- const high = app.globalData.safeBottom
- this.setData({
- safeBottom: `${high}px`,
- id: options.id
- })
- this.getList()
- },
- //查看订单
- examineOrder(e){
- this.setData({
- order: e.currentTarget.dataset.order,
- popupOrder:true
- })
- },
- closePop(){
- this.setData({
- popupOrder:false
- })
- },
- //切换
- select(e){
- this.setData({
- skill_id:e.currentTarget.dataset.id
- })
- },
- onClose() {
- this.setData({ popupOrder: false });
- },
- /**
- * 生命周期函数--监听页面初次渲染完成
- */
- onReady() {
- },
- /**
- * 生命周期函数--监听页面显示
- */
- onShow() {
- },
- /**
- * 生命周期函数--监听页面隐藏
- */
- onHide() {
- },
- /**
- * 生命周期函数--监听页面卸载
- */
- onUnload() {
- },
- /**
- * 页面相关事件处理函数--监听用户下拉动作
- */
- onPullDownRefresh() {
- },
- /**
- * 页面上拉触底事件的处理函数
- */
- onReachBottom() {
- },
- /**
- * 用户点击右上角分享
- */
- onShareAppMessage() {
- }
- })
|