纸通宝小程序
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.
 

65 lines
2.0 KiB

// pages/message/index.js
const util = require('../../../utils/util')
const app = getApp()
Component({
options: {
addGlobalClass: true,
multipleSlots: true
},
properties: {
item: { type: Object, value: null }
},
data: {
kg: app.globalData.kg
},
lifetimes: {
// 生命周期函数,可以为函数,或一个在methods段中定义的方法名
attached: function () {
this.setData({ kg: app.globalData.kg })
}
},
methods: {
toAbilityRule: function (e) {
util.navigateTarget(this.data.item.redirectInfo)
},
unflodItem: function(){
this.setData({ ['item.fold']: !this.data.item.fold })
},
checkTag: function(event){
var cateIndex = -1
if(util.isEmpty(this.data.item.cateIndex)){
cateIndex = event.currentTarget.dataset.ck
} else if(this.data.item.cateIndex != event.currentTarget.dataset.ck){
cateIndex = event.currentTarget.dataset.ck
}
if(cateIndex >= 0){
this.setData({ ['item.cateIndex']: cateIndex })
}
},
saleGood: function(e){
if (!app.globalData.userInfo) {
wx.navigateTo({ url: '/pages/login/index' })
return
}
if(!this.data.item.isOperations){
util.showToast(this.data.item.manageNotifyMessage)
return
}
if(util.isEmpty(this.data.item.cateIndex)){
util.showToast('请选择一个纸品')
return
}
if(util.isEmpty(this.data.item.paperCategoryList[this.data.item.cateIndex].unitPrice)){
util.showToast('该纸品暂无报价,无法卖货')
return
}
var categoryId = this.data.item.paperCategoryList[this.data.item.cateIndex].categoryId
var activityId = this.data.item.activityId
var unitPrice = this.data.item.paperCategoryList[this.data.item.cateIndex].unitPrice
var params = this.data.item.paperMillId + '&categoryId=' + categoryId + '&activityId=' + activityId + '&unitPrice=' + unitPrice
wx.navigateTo({ url: '/pages/agent/edit/index?id=' + params })
}
}
})