纸通宝小程序
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

52 lines
1.6 KiB

// pages/agent/vehicles/index.js
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
data: {
height: app.globalData.fragmentHeight,
loading: true,
plateList: []
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ height: app.globalData.fragmentHeight })
// /proxy-sell/get/his-car-info客户查看历史车辆
request.get('/recycle-service/proxy-sell/get/his-car-info').then(result => {
this.setData({ plateList: result.data.records, loading: false })
}).catch(err => {
//异常回调
this.setData({ loading: false })
util.showToast(err)
})
},
selectItem: function (e) {
var item = this.data.plateList[e.currentTarget.dataset.index]
event.emit('EventMessage', { what: 402, obj: item, desc: 'PlateChoose' })
wx.navigateBack({ delta: 1 })
},
deleteItem: function (e) {
var item = this.data.plateList[e.currentTarget.dataset.index]
wx.showLoading({ title: '加载中', mask: true })
// /proxy-sell/get/his-car-info客户查看历史车辆
request.get('/recycle-service/proxy-sell/delete/his-car-info', { id: item.id }).then(result => {
this.data.plateList.splice(e.currentTarget.dataset.index, 1)
this.setData({ plateList: this.data.plateList })
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})
}
})