Browse Source

--分享至朋友圈--

featrue/v4.3
DESKTOP-A1SENDA\HUzy 5 years ago
parent
commit
0009fe8dc8
17 changed files with 457 additions and 187 deletions
  1. 13
      pages/agent/factory/index.js
  2. 40
      pages/article/attentionPaperFactory/index.js
  3. 173
      pages/article/detail/index.js
  4. 68
      pages/article/feedback/index.js
  5. 4
      pages/article/newInfo/index.wxml
  6. 6
      pages/article/sucessFul/index.js
  7. 24
      pages/goods/detail/index.js
  8. 33
      pages/home/businessLicense/index.js
  9. 11
      pages/home/index/index.js
  10. 6
      pages/home/tab1/index.js
  11. 20
      pages/home/tab2/index.js
  12. 8
      pages/home/tab3/index.js
  13. 16
      pages/home/tab4/index.js
  14. 16
      pages/home/tab5/index.js
  15. 8
      pages/home/tab6/index.js
  16. 124
      pages/mall/detail/index.js
  17. 74
      pages/purchase/detail/index.js

13
pages/agent/factory/index.js

@ -188,12 +188,21 @@ Page({
})
})
},
//分享至朋友
onShareAppMessage: function () {
return {
title: this.data.factoryDetail.name + '废纸报价',
path: 'pages/index/index?url=/pages/agent/factory/index&key=id&value=' + this.data.factoryDetail.paperMillId
}
},
//分享至朋友圈
onShareTimeline(res){
console.log(res)
return {
title: this.data.factoryDetail.name + '废纸报价',
path: 'pages/index/index?url=/pages/agent/factory/index&key=id&value=' + this.data.factoryDetail.paperMillId
}
},
toService: function () {
wx.navigateTo({
url: '/pages/home/service/index'
@ -248,6 +257,6 @@ Page({
wx.hideLoading()
util.showToast(err)
})
}
},
})

40
pages/article/attentionPaperFactory/index.js

@ -1,7 +1,7 @@
// pages/home/tab4/index.js
import {
getFactoryPrice,
userPushFollowMill
userPushFollowMill
} from '../../api/ztb'
const event = require('../../../utils/event.js')
const storage = require('../../../utils/storage')
@ -12,10 +12,10 @@ Page({
* 页面的初始数据
*/
data: {
loopRequesting:false,
loopRequesting: false,
form: {
paperMillIds: [],
},
model: {
paperMillIds: [],
@ -23,12 +23,12 @@ Page({
enableSalesAgent: 1,
pageNum: 1,
listType: 0,
pageSize:1000
pageSize: 1000
},
categoryListone: [],
safeBottom: app.globalData.safeBottom,
userInfo: null,
loading:true
loading: true
},
@ -36,11 +36,17 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({ safeBottom: app.globalData.safeBottom, userInfo: app.globalData.userInfo })
this.setData({
safeBottom: app.globalData.safeBottom,
userInfo: app.globalData.userInfo
})
this.getFactoryPriceFct(this.data.model)
},
toMyInfo: function () {
event.emit('EventMessage', { what: 1100, desc: 'attentionPaperList' })
event.emit('EventMessage', {
what: 1100,
desc: 'attentionPaperList'
})
wx.navigateBack()
},
/**
@ -90,6 +96,12 @@ Page({
*/
onShareAppMessage: function () {
},
/**
* 分享至朋友圈
*/
onShareTimeline: function (){
},
backspace: function () {
// console.log('点击返回被触发4')
@ -98,25 +110,25 @@ Page({
})
},
getFactoryPriceFct:function(model){
getFactoryPrice(model).then(res=>{
getFactoryPriceFct: function (model) {
getFactoryPrice(model).then(res => {
this.setData({
categoryListone:res.data.records,
loading:false
categoryListone: res.data.records,
loading: false
})
})
},
checkboxChange: function (e) {
console.log(e)
this.setData({
'form.paperMillIds':e.detail.value,
'form.follow':true
'form.paperMillIds': e.detail.value,
'form.follow': true
})
},
bindtap: function (e) {
console.log(e)
},
submitForm:function(){
submitForm: function () {
userPushFollowMill(this.data.form).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toMyInfo(), 1000)

173
pages/article/detail/index.js

@ -1,4 +1,10 @@
import { getMomentDetail, getCommentList, likeMoment, likeComment, commentMoment } from "../../api/moment"
import {
getMomentDetail,
getCommentList,
likeMoment,
likeComment,
commentMoment
} from "../../api/moment"
const util = require('../../../utils/util')
const app = getApp()
// pages/moment/detail/index.js
@ -11,9 +17,16 @@ Page({
safeBottom: app.globalData.safeBottom,
height: app.globalData.safeFragmentHeight,
type: 0,
tabList: [
{id: 0, name: '评论', badge: 12},
{id: 1, name: '系统', badge: 0}
tabList: [{
id: 0,
name: '评论',
badge: 12
},
{
id: 1,
name: '系统',
badge: 0
}
],
tabIndex: 0,
inputBottom: 0,
@ -33,16 +46,25 @@ Page({
*/
onLoad: function (options) {
this.data.keyboardHeight = wx.getStorageSync('keyboardHeight')
if(options.type){
if (options.type) {
this.data.type = Number(options.type)
}
this.setData({ type: this.data.type, safeBottom: app.globalData.safeBottom, height: app.globalData.safeFragmentHeight - 100 })
if(options.id){
this.setData({
type: this.data.type,
safeBottom: app.globalData.safeBottom,
height: app.globalData.safeFragmentHeight - 100
})
if (options.id) {
this.data.id = options.id
this.data.form.articleId = options.id
wx.showLoading({ title: '加载中', mask: true })
wx.showLoading({
title: '加载中',
mask: true
})
getMomentDetail(options.id).then(result => {
this.setData({ momentDetail: result.data })
this.setData({
momentDetail: result.data
})
this.fetchCommentList()
wx.hideLoading()
}).catch(err => {
@ -62,18 +84,20 @@ Page({
})
this.fetchCommentList()
},
fetchCommentList: function(){
fetchCommentList: function () {
if (this.data.requesting || this.data.finished) {
return
}
this.setData({ requesting: true })
this.setData({
requesting: true
})
getCommentList(this.data.id, this.data.form).then(result => {
if (result.data.records.length) {
var respList = result.data.records
let nowList = `commentList[${this.data.commentList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= result.data.pages
if(num == 1){
if (num == 1) {
this.setData({
commentList: [],
[nowList]: respList,
@ -92,10 +116,15 @@ Page({
})
}
} else {
this.setData({ requesting: false, finished: true })
this.setData({
requesting: false,
finished: true
})
}
}).catch(err => {
this.setData({ requesting: false })
this.setData({
requesting: false
})
})
},
onTabChange: function (e) {
@ -104,40 +133,62 @@ Page({
}
this.data.tabIndex = Number(e.detail.key)
},
bindInput: function(e){
bindInput: function (e) {
this.data.comment = e.detail.value
},
inputFocus: function(e) {
if(this.data.keyboardHeight){
inputFocus: function (e) {
if (this.data.keyboardHeight) {
return
}
this.data.keyboardHeight = Number(e.detail.height)
wx.setStorageSync('keyboardHeight', this.data.keyboardHeight)
this.setData({ inputBottom: e.detail.height })
this.setData({
inputBottom: e.detail.height
})
},
inputBlur: function(e) {
this.setData({ inputBottom: 0, focus: false })
inputBlur: function (e) {
this.setData({
inputBottom: 0,
focus: false
})
},
showComment: function(e) {
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
showComment: function (e) {
if (!app.globalData.userInfo) {
wx.navigateTo({
url: '/pages/login/index'
})
return
}
if(this.data.keyboardHeight){
this.setData({ focus: true,inputBottom: this.data.keyboardHeight })
if (this.data.keyboardHeight) {
this.setData({
focus: true,
inputBottom: this.data.keyboardHeight
})
} else {
this.setData({ focus: true })
this.setData({
focus: true
})
}
},
submitComment: function(){
if(util.isEmpty(this.data.comment)){
submitComment: function () {
if (util.isEmpty(this.data.comment)) {
util.showToast('请输入评论内容')
return
}
wx.showLoading({ title: '处理中', mask: true })
var form = { content: this.data.comment, articleId: this.data.id}
wx.showLoading({
title: '处理中',
mask: true
})
var form = {
content: this.data.comment,
articleId: this.data.id
}
commentMoment(form).then(result => {
this.setData({ inputBottom: 0, focus: false, comment: '' })
this.setData({
inputBottom: 0,
focus: false,
comment: ''
})
wx.hideLoading()
util.showToast('评论成功')
this.onRefreshList()
@ -146,56 +197,64 @@ Page({
util.showToast(error)
})
},
postLikeComment: function(e){
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
postLikeComment: function (e) {
if (!app.globalData.userInfo) {
wx.navigateTo({
url: '/pages/login/index'
})
return
}
var item = this.data.commentList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
if(item.isLiked){
if (item.isLiked) {
util.showToast('请勿重复点赞')
return
}
likeComment({replyId: item.id}).then(result => {
if(item.isLiked){
this.setData({
likeComment({
replyId: item.id
}).then(result => {
if (item.isLiked) {
this.setData({
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].likeQuantity']: result.data.likeQuantity,
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].isLiked']: 0
})
})
} else {
this.setData({
this.setData({
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].likeQuantity']: result.data.likeQuantity,
['commentList[' + e.currentTarget.dataset.page + '][' + e.currentTarget.dataset.index + '].isLiked']: 1
})
})
}
}).catch(error => {
util.showToast(error)
})
},
likePost: function(){
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index' })
likePost: function () {
if (!app.globalData.userInfo) {
wx.navigateTo({
url: '/pages/login/index'
})
return
}
if(this.data.momentDetail.isLiked){
if (this.data.momentDetail.isLiked) {
util.showToast('请勿重复点赞')
return
}
likeMoment({articleId: this.data.id}).then(result => {
this.setData({
likeMoment({
articleId: this.data.id
}).then(result => {
this.setData({
['momentDetail.likeQuantity']: result.data.likeQuantity,
['momentDetail.isLiked']: 1
})
})
}).catch(error => {
util.showToast(error)
})
},
toMill: function(){
toMill: function () {
util.navigateTo('/pages/agent/factory/index?id=' + this.data.momentDetail.millPaperId)
},
onShareAppMessage: function () {
var imageUrl = '/assets/image/icon_logo.png'
if(this.data.momentDetail.imgUrlList && this.data.momentDetail.imgUrlList.length > 0){
if (this.data.momentDetail.imgUrlList && this.data.momentDetail.imgUrlList.length > 0) {
imageUrl = this.data.momentDetail.imgUrlList[0]
}
return {
@ -203,5 +262,17 @@ Page({
path: 'pages/index/index?url=/pages/article/detail/index&key=id&value=' + this.data.momentDetail.id,
imageUrl: imageUrl
}
}
},
//分享至朋友圈
onShareTimeline(res) {
var imageUrl = '/assets/image/icon_logo.png'
if (this.data.momentDetail.imgUrlList && this.data.momentDetail.imgUrlList.length > 0) {
imageUrl = this.data.momentDetail.imgUrlList[0]
}
return {
title: this.data.momentDetail.title,
path: 'pages/index/index?url=/pages/article/detail/index&key=id&value=' + this.data.momentDetail.id,
imageUrl: imageUrl
}
},
})

68
pages/article/feedback/index.js

@ -1,5 +1,8 @@
// pages/article/feedback/index.js
import { getAllFactoryList,feedbackMillInformation} from "../../api/ztb"
import {
getAllFactoryList,
feedbackMillInformation
} from "../../api/ztb"
const util = require('../../../utils/util')
Page({
@ -7,16 +10,16 @@ Page({
* 页面的初始数据
*/
data: {
millIdList:[],
millIdList: [],
fatoryNameList: [],
fatoryNameIndex: null,
typeIdList:['1','2','3'],
typeList:['价格','纸厂排队','最近扣点'],
typeIndex:null,
postForm:{
content:'',
millId:null,
type:null
typeIdList: ['1', '2', '3'],
typeList: ['价格', '纸厂排队', '最近扣点'],
typeIndex: null,
postForm: {
content: '',
millId: null,
type: null
}
},
@ -75,66 +78,71 @@ Page({
*/
onShareAppMessage: function () {
},
/**
* 分享至朋友圈
*/
onShareTimeline: function () {
},
PickerChange(e) {
console.log(e);
this.setData({
fatoryNameIndex: e.detail.value,
'postForm.millId':this.data.millIdList[e.detail.value]
'postForm.millId': this.data.millIdList[e.detail.value]
})
},
typeChange(e) {
console.log(e);
this.setData({
typeIndex: e.detail.value,
'postForm.type':this.data.typeIdList[e.detail.value]
'postForm.type': this.data.typeIdList[e.detail.value]
})
},
getAllFactoryListFct:function(){
this.data.fatoryNameList=[]
this.data.millIdList=[]
var jxFatoryNameList=[]
var jxMillIdList=[]
getAllFactoryList().then(res=>{
getAllFactoryListFct: function () {
this.data.fatoryNameList = []
this.data.millIdList = []
var jxFatoryNameList = []
var jxMillIdList = []
getAllFactoryList().then(res => {
res.data.forEach(element => {
jxFatoryNameList.push(element.name)
jxMillIdList.push(element.paperMillId)
jxMillIdList.push(element.paperMillId)
});
this.setData({
fatoryNameList: jxFatoryNameList,
millIdList:jxMillIdList
millIdList: jxMillIdList
})
})
},
subFeedBack:function(){
if(this.data.postForm.millId==''||this.data.postForm.millId==null){
subFeedBack: function () {
if (this.data.postForm.millId == '' || this.data.postForm.millId == null) {
util.showToast('请选择纸厂')
return
}
if(this.data.postForm.type==''||this.data.postForm.type==null){
if (this.data.postForm.type == '' || this.data.postForm.type == null) {
util.showToast('请选类型')
return
}
if(this.data.postForm.content==''||this.data.postForm.content==null){
if (this.data.postForm.content == '' || this.data.postForm.content == null) {
util.showToast('请填写内容')
return
}
this.feedbackMillInformationFct(this.data.postForm)
},
textareaBindblur:function(e){
textareaBindblur: function (e) {
// console.log(e.detail.value)
this.setData({
'postForm.content':e.detail.value
'postForm.content': e.detail.value
})
},
feedbackMillInformationFct:function(model){
feedbackMillInformation(model).then(res=>{
if(res.code==0){
feedbackMillInformationFct: function (model) {
feedbackMillInformation(model).then(res => {
if (res.code == 0) {
util.showToast('提交成功!')
util.navigateTo('/pages/article/sucessFul/index')
}else{
util.showToast('提交失败失败!原因:'+res.message)
} else {
util.showToast('提交失败失败!原因:' + res.message)
}
})
}

4
pages/article/newInfo/index.wxml

@ -64,7 +64,7 @@
<text style="margin-left:40rpx">{{ formate.formateDrice(item.unitPrice)}}</text><text
style="font-size: 32rpx;">{{item.biggestFloatPrice>0?'↑':(item.biggestFloatPrice<0?'↓':'')}}</text>
<text wx:if="{{item.biggestFloatPrice != 0}}"
style="margin-left: 12rpx;font-size:24rpx">{{ item.biggestFloatPrice > 0 ? '+' : '-' }}{{ formate.formateDrice(item.biggestFloatPrice)}}</text>
style="margin-left: 12rpx;font-size:24rpx">{{ item.biggestFloatPrice > 0 ? '+' : '' }}{{ formate.formateDrice(item.biggestFloatPrice)}}</text>
</view>
<view class="text-df text-balck" style="flex:0.8;text-align: center">{{item.yesterdayTotalQuantity || 0}}辆
</view>
@ -106,7 +106,7 @@
style="font-size:32rpx">{{cell.floatPrice>0?'↑':(cell.floatPrice<0?'↓':'')}}</text></view>
<view class="text-df {{cell.floatPrice>0?'text-red':(cell.floatPrice<0?'text-green':'text-black')}}"
style="flex:1;text-align: center" style="flex:1;text-align: center;font-size:24rpx">
{{cell.floatPrice>0?'+':'-'}}{{formate.formatePrice(cell.floatPrice)}}</view>
{{cell.floatPrice>0?'+':''}}{{formate.formatePrice(cell.floatPrice)}}</view>
<view class="text-df text-balck"
style="flex:1;text-align: center" style="flex:1;text-align: center">
{{formate.formateDescripe(cell.curDeductionPoint)}}</view>

6
pages/article/sucessFul/index.js

@ -63,6 +63,12 @@ Page({
*/
onShareAppMessage: function () {
},
/**
* 分享至朋友圈
*/
onShareTimeline:function(){
},
rt:function(){
wx.navigateBack()

24
pages/goods/detail/index.js

@ -1,5 +1,7 @@
// pages/order/order-info/index.js
import { getProductInfo } from "../../api/ztb"
import {
getProductInfo
} from "../../api/ztb"
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const event = require('../../../utils/event')
@ -42,7 +44,10 @@ Page({
})
event.on('EventMessage', this, this.onEvent)
if (options.id) {
wx.showLoading({ title: '加载中', mask: true })
wx.showLoading({
title: '加载中',
mask: true
})
getProductInfo(options.id).then(result => {
wx.hideLoading()
var vurl = null
@ -78,7 +83,7 @@ Page({
onEvent: function (message) {
console.log('mall>>order>>onEvent', message)
if (message.what == 1) {
} else if (message.what == 10) {
wx.navigateBack()
}
@ -277,7 +282,9 @@ Page({
this.data.form.outline = this.data.orderInfo.outline
this.data.form.litimgUrl = this.data.orderInfo.litimgUrl
this.data.form.unit = this.data.orderInfo.unit
wx.navigateTo({ url: '/pages/mall/order-offer/index?json=' + JSON.stringify(this.data.form) })
wx.navigateTo({
url: '/pages/mall/order-offer/index?json=' + JSON.stringify(this.data.form)
})
},
onShareAppMessage: function () {
return {
@ -287,6 +294,15 @@ Page({
success: function (res) {}
}
},
// 分享至朋友圈
onShareTimeline(res) {
return {
title: this.data.orderInfo.name,
path: '/pages/mall/order-info/index?id=' + this.data.orderInfo.id,
imageUrl: this.data.orderInfo.litimgUrl,
success: function (res) {}
}
},
// event的unregister
onUnload: function () {
event.remove('EventMessage', this)

33
pages/home/businessLicense/index.js

@ -10,10 +10,10 @@ Page({
* 页面的初始数据
*/
data: {
fileList:[],
imgLength:0,
form:{
imgList:''
fileList: [],
imgLength: 0,
form: {
imgList: ''
}
},
@ -73,9 +73,13 @@ Page({
*/
onShareAppMessage: function () {
},
// 分享至朋友圈
onShareTimeline: function () {
},
onImageChange: function (e) {
var that=this
var that = this
if (e.detail) {
var list = []
e.detail.forEach(element => {
@ -84,7 +88,9 @@ Page({
}
})
that.data.form['imgList'] = list
that.updateUserInfoFct({businessLicenseUrl:e.detail[0].url})
that.updateUserInfoFct({
businessLicenseUrl: e.detail[0].url
})
that.setData({
imgLength: list.length
})
@ -93,21 +99,22 @@ Page({
},
updateUserInfoFct: function (model) {
console.log(model)
updateUserInfo(model).then(result => {
}).catch(err => {
})
updateUserInfo(model).then(result => {}).catch(err => {})
},
getUerInfoFct: function () {
var that=this
var that = this
getBaseInfo().then(res => {
that.data.form['imgList'] = res.data.businessLicenseUrl
var list=[]
if(res.data.businessLicenseUrl){
var list = []
if (res.data.businessLicenseUrl) {
list.push(res.data.businessLicenseUrl)
}
that.setData({
imgLength: list.length,
fileList:[{ url: res.data.businessLicenseUrl, status: 8 }]
fileList: [{
url: res.data.businessLicenseUrl,
status: 8
}]
})
})
}

11
pages/home/index/index.js

@ -48,7 +48,7 @@ Component({
if (app.globalData.userInfo && app.globalData.userInfo.memberExpiredAt) {
this.setData({
'userInfo.memberExpiredAt': app.globalData.userInfo.memberExpiredAt,
userName:app.globalData.userInfo.realName||app.globalData.userInfo.nickname||''
userName: app.globalData.userInfo.realName || app.globalData.userInfo.nickname || ''
})
}
}
@ -224,6 +224,13 @@ Component({
title: '分享纸通宝',
path: '/pages/home/index'
}
}
},
// 分享至朋友圈
onShareTimeline() {
return {
title: '分享纸通宝',
path: '/pages/home/index'
}
},
}
})

6
pages/home/tab1/index.js

@ -78,6 +78,10 @@ Page({
*/
onShareAppMessage: function () {
},
// 分享至朋友圈
onShareTimeline() {
},
backspace: function () {
return
@ -149,5 +153,5 @@ Page({
}
})
},
})

20
pages/home/tab2/index.js

@ -15,7 +15,7 @@ Page({
region: [440000, ''],
form: {
bidType: 1,
areaStr:''
areaStr: ''
},
cateName: '',
dopantName: '',
@ -94,6 +94,10 @@ Page({
*/
onShareAppMessage: function () {
},
// 分享至朋友圈
onShareTimeline() {
},
backspace: function () {
console.log('点击返回被触发2')
@ -119,11 +123,15 @@ Page({
this.data.form['locCityName'] = e.detail.options[1].label
this.data.form['locDistrictId'] = e.detail.value[2]
this.data.form['locDistrictName'] = e.detail.options[2].label
this.setData({ picking: false })
this.setData({
'form.areaStr':e.detail.options[0].label+e.detail.options[1].label
picking: false
})
this.setData({
'form.areaStr': e.detail.options[0].label + e.detail.options[1].label
})
this.submitForm({
locateCityTag: this.data.form.locCityId
})
this.submitForm({locateCityTag:this.data.form.locCityId})
}
},
submitForm: function (model) {
@ -138,8 +146,8 @@ Page({
getUerInfoFct: function () {
getBaseInfo().then(res => {
this.setData({
region:[res.data.locateCityTag.provinceId,res.data.locateCityTag.cityId,res.data.locateCityTag.districtId],
'form.areaStr':res.data.locateCityTag.provinceName+res.data.locateCityTag.cityName
region: [res.data.locateCityTag.provinceId, res.data.locateCityTag.cityId, res.data.locateCityTag.districtId],
'form.areaStr': res.data.locateCityTag.provinceName + res.data.locateCityTag.cityName
})
console.log(this.data.region)
})

8
pages/home/tab3/index.js

@ -78,6 +78,10 @@ Page({
*/
onShareAppMessage: function () {
},
// 分享至朋友圈
onShareTimeline() {
},
backspace: function () {
console.log('点击返回被触发3')
@ -95,8 +99,8 @@ Page({
this.setData({
['bidType']: tabIndex
})
var model={
experienceTag:''
var model = {
experienceTag: ''
}
if (this.data.bidType == 1) {
model.experienceTag = '1年以下'

16
pages/home/tab4/index.js

@ -10,7 +10,7 @@ Page({
* 页面的初始数据
*/
data: {
loopRequesting:false,
loopRequesting: false,
form: {
purchaseCategoriesTag: []
},
@ -108,6 +108,10 @@ Page({
*/
onShareAppMessage: function () {
},
// 分享至朋友圈
onShareTimeline() {
},
backspace: function () {
// console.log('点击返回被触发4')
@ -117,22 +121,24 @@ Page({
},
getLategoriesListFct: function () {
getLategoriesList({categoryType:0}).then(res => {
getLategoriesList({
categoryType: 0
}).then(res => {
this.setData({
categoryListone:res.data
categoryListone: res.data
})
})
},
checkboxChange: function (e) {
console.log(e)
this.setData({
'form.purchaseCategoriesTag':e.detail.value
'form.purchaseCategoriesTag': e.detail.value
})
},
bindtap: function (e) {
console.log(e)
},
submitForm:function(){
submitForm: function () {
updateUserInfo(this.data.form).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toMyInfo(), 1000)

16
pages/home/tab5/index.js

@ -10,7 +10,7 @@ Page({
* 页面的初始数据
*/
data: {
loopRequesting:false,
loopRequesting: false,
form: {
proxyCategoriesTag: []
},
@ -108,6 +108,10 @@ Page({
*/
onShareAppMessage: function () {
},
// 分享至朋友圈
onShareTimeline() {
},
backspace: function () {
// console.log('点击返回被触发4')
@ -117,22 +121,24 @@ Page({
},
getLategoriesListFct: function () {
getLategoriesList({categoryType:1}).then(res => {
getLategoriesList({
categoryType: 1
}).then(res => {
this.setData({
categoryListone:res.data
categoryListone: res.data
})
})
},
checkboxChange: function (e) {
console.log(e)
this.setData({
'form.proxyCategoriesTag':e.detail.value
'form.proxyCategoriesTag': e.detail.value
})
},
bindtap: function (e) {
console.log(e)
},
submitForm:function(){
submitForm: function () {
updateUserInfo(this.data.form).then(result => {
this.data.loopRequesting = false
setTimeout(() => this.toMyInfo(), 1000)

8
pages/home/tab6/index.js

@ -73,6 +73,10 @@ Page({
*/
onShareAppMessage: function () {
},
// 分享至朋友圈
onShareTimeline() {
},
backspace: function () {
console.log('点击返回被触发3')
@ -90,8 +94,8 @@ Page({
this.setData({
['bidType']: tabIndex
})
var model={
experienceTag:''
var model = {
experienceTag: ''
}
if (this.data.bidType == 1) {
model.shipmentPerMonth = '1000吨以下'

124
pages/mall/detail/index.js

@ -1,6 +1,12 @@
// pages/order/order-info/index.js
import { biddingActivity, getBiddingList, getUserProduct } from "../../api/ztb"
import { $wuxCountDown } from '../../../components/index'
import {
biddingActivity,
getBiddingList,
getUserProduct
} from "../../api/ztb"
import {
$wuxCountDown
} from '../../../components/index'
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const event = require('../../../utils/event.js')
@ -35,9 +41,15 @@ Page({
*/
onLoad: function (options) {
if (getCurrentPages().length == 1) {
this.setData({ backStr: '首页' })
this.setData({
backStr: '首页'
})
}
this.setData({ imageHeight: 750, kg: app.globalData.kg, safeBottom: app.globalData.safeBottom })
this.setData({
imageHeight: 750,
kg: app.globalData.kg,
safeBottom: app.globalData.safeBottom
})
event.on('EventMessage', this, this.onEvent)
if (options.id) {
wx.showLoading({
@ -81,15 +93,17 @@ Page({
text: '确定',
type: 'primary',
onTap(e) {
wx.navigateBack({ delta: 1 })
wx.navigateBack({
delta: 1
})
}
}]
})
} else if (result.data.bidType == 2 && (result.data.biddingActivityStatus != 0)) {
} else if (result.data.bidType == 2 && result.data.biddingActivityStatus == 0) {
this.fetchBiddingList(result.data.biddingActivityId)
if(this.data.frist){
if (this.data.frist) {
this.expiredTime(result.data.biddingActivityExpiredTime, id)
}
}
@ -109,9 +123,13 @@ Page({
const min = this.leadingZeros(date.min, 2) + ' 分 '
const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
if (Number(this.leadingZeros(date.days, 1)) > 0) {
that.setData({ expiredTime: days + hours + min + sec })
that.setData({
expiredTime: days + hours + min + sec
})
} else {
that.setData({ expiredTime: hours + min + sec })
that.setData({
expiredTime: hours + min + sec
})
}
},
onEnd() {
@ -119,19 +137,24 @@ Page({
}
})
},
onChange: function(e){
this.setData({ current: e.detail.current + 1 })
onChange: function (e) {
this.setData({
current: e.detail.current + 1
})
},
fetchBiddingList: function (biddingActivityId) {
getBiddingList(biddingActivityId).then(result => {
for (let index = 0; index < result.data.records.length; index++) {
const element = result.data.records[index]
if(element.isMine && app.globalData.userInfo){
if (element.isMine && app.globalData.userInfo) {
this.data.offered = element.biddingUnitPrice
break
}
}
this.setData({ recordList: result.data.records, offered: this.data.offered })
this.setData({
recordList: result.data.records,
offered: this.data.offered
})
})
},
isVideoUrl: function (url) {
@ -166,7 +189,9 @@ Page({
},
bindended: function () {
this.videoContext.exitFullScreen()
this.setData({ visible: false })
this.setData({
visible: false
})
},
// 图片查看
viewImage: function (e) {
@ -180,12 +205,17 @@ Page({
}
imgList.push(this.data.imgList[index])
}
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
wx.previewImage({
urls: imgList,
current: e.currentTarget.dataset.url
})
},
// 进入支付流程
offerProject: function (e) {
if (!app.globalData.userInfo) {
wx.navigateTo({ url: '/pages/login/index' })
wx.navigateTo({
url: '/pages/login/index'
})
return
}
if (!app.globalData.userInfo.isVIP) {
@ -197,7 +227,9 @@ Page({
text: '确定',
type: 'primary',
onTap(e) {
wx.navigateTo({ url: '/pages/ztbvip/index' })
wx.navigateTo({
url: '/pages/ztbvip/index'
})
}
}]
})
@ -215,9 +247,11 @@ Page({
}]
})
return
}
}
if (this.data.orderInfo.bidType == 1) {
wx.navigateTo({ url: '/pages/morder/create/index?productId=' + this.data.orderInfo.productId })
wx.navigateTo({
url: '/pages/morder/create/index?productId=' + this.data.orderInfo.productId
})
} else {
var that = this
// this.biddingDialog.showBidding(this.data.orderInfo)
@ -229,7 +263,7 @@ Page({
value: that.formatePrice(price, app.globalData.kg),
step: that.formatePrice(that.data.orderInfo.biddingRange, app.globalData.kg),
content: '请输入您的报价(元/' + (app.globalData.kg ? 'KG' : '吨') + ')',
fieldtype: app.globalData.kg ? 'digit' : 'numger',
fieldtype: app.globalData.kg ? 'digit' : 'numger',
defaultText: '',
placeholder: '请输入您的报价',
maxlength: 8,
@ -242,7 +276,7 @@ Page({
},
formatePrice: function (value, kg) {
if (value || value == 0) {
if(kg){
if (kg) {
return (parseFloat(value)).toFixed(3)
} else {
return (parseFloat(value) * 1000).toFixed(1)
@ -252,14 +286,37 @@ Page({
},
onShareAppMessage: function () {
var title = this.data.orderInfo.locProvinceName + this.data.orderInfo.locCityName
if(this.data.orderInfo.bidType == 2){
if (this.data.orderInfo.bidType == 2) {
title += this.data.orderInfo.secondCategoryName + '竞价中'
} else {
title += '出售' + this.data.orderInfo.secondCategoryName
}
var imgUrl = this.data.orderInfo.imgList[0]
if (this.isVideoUrl(imgUrl)) {
if (this.data.orderInfo.imgList.length > 1) {
imgUrl = this.data.orderInfo.imgList[1]
} else {
imgUrl = '/assets/image/icon_logo.png'
}
}
return {
title: title,
path: 'pages/index/index?url=/pages/mall/detail/index&key=id&value=' + this.data.orderInfo.productId,
imageUrl: imgUrl,
success: function (res) {}
}
},
// 分享至朋友圈
onShareTimeline() {
var title = this.data.orderInfo.locProvinceName + this.data.orderInfo.locCityName
if (this.data.orderInfo.bidType == 2) {
title += this.data.orderInfo.secondCategoryName + '竞价中'
} else {
title += '出售' + this.data.orderInfo.secondCategoryName
}
var imgUrl = this.data.orderInfo.imgList[0]
if(this.isVideoUrl(imgUrl) ){
if(this.data.orderInfo.imgList.length > 1){
if (this.isVideoUrl(imgUrl)) {
if (this.data.orderInfo.imgList.length > 1) {
imgUrl = this.data.orderInfo.imgList[1]
} else {
imgUrl = '/assets/image/icon_logo.png'
@ -284,23 +341,30 @@ Page({
if (!this.data.orderInfo) {
return
}
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index'})
if (!app.globalData.userInfo) {
wx.navigateTo({
url: '/pages/login/index'
})
return
}
util.navigateTo('/pages/shop/detail/index?storeId=' + this.data.orderInfo.storeId)
},
biddingPrice: function (price) {
if(util.isEmpty(price)){
if (util.isEmpty(price)) {
util.showToast('请输入您的报价')
return
}
if(Number(price) <= 0){
if (Number(price) <= 0) {
util.showToast('请输入合理的报价')
return
}
wx.showLoading({ title: '加载中', mask: true })
biddingActivity(this.data.orderInfo.biddingActivityId, { biddingUnitPrice: price }).then(result => {
wx.showLoading({
title: '加载中',
mask: true
})
biddingActivity(this.data.orderInfo.biddingActivityId, {
biddingUnitPrice: price
}).then(result => {
wx.hideLoading()
this.fetchBiddingList(this.data.orderInfo.biddingActivityId)
util.showToast('报价成功')

74
pages/purchase/detail/index.js

@ -1,5 +1,7 @@
// pages/order/order-info/index.js
import { getPurchaseInfo } from "../../api/ztb"
import {
getPurchaseInfo
} from "../../api/ztb"
const util = require('../../../utils/util')
const app = getApp()
@ -20,10 +22,15 @@ Page({
*/
onLoad: function (options) {
if (getCurrentPages().length == 1) {
this.setData({ backStr: '首页' })
this.setData({
backStr: '首页'
})
}
if (options.id) {
wx.showLoading({ title: '加载中', mask: true })
wx.showLoading({
title: '加载中',
mask: true
})
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
this.biddingDialog = this.biddingDialog || this.selectComponent('#bidding-good')
this.fetchInfo(options.id)
@ -50,9 +57,12 @@ Page({
for (let index = 0; index < this.data.imgList.length; index++) {
imgList.push(this.data.imgList[index])
}
wx.previewImage({ urls: imgList, current: e.currentTarget.dataset.url })
wx.previewImage({
urls: imgList,
current: e.currentTarget.dataset.url
})
},
check: function(){
check: function () {
if (!app.globalData.userInfo.isVIP) {
this.wuxDialog.open({
resetOnClose: true,
@ -62,7 +72,9 @@ Page({
text: '确定',
type: 'primary',
onTap(e) {
wx.navigateTo({ url: '/pages/ztbvip/index' })
wx.navigateTo({
url: '/pages/ztbvip/index'
})
}
}]
})
@ -74,31 +86,39 @@ Page({
if (!this.data.orderInfo) {
return
}
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index'})
if (!app.globalData.userInfo) {
wx.navigateTo({
url: '/pages/login/index'
})
return
}
if(this.check()){
wx.navigateTo({ url: '/pages/shop/detail/index?storeId=' + this.data.orderInfo.storeId })
if (this.check()) {
wx.navigateTo({
url: '/pages/shop/detail/index?storeId=' + this.data.orderInfo.storeId
})
}
},
phoneShopInfo: function(){
if(!app.globalData.userInfo){
wx.navigateTo({ url: '/pages/login/index'})
phoneShopInfo: function () {
if (!app.globalData.userInfo) {
wx.navigateTo({
url: '/pages/login/index'
})
return
}
if(this.check()){
wx.makePhoneCall({ phoneNumber: this.data.orderInfo.ownerPhone })
if (this.check()) {
wx.makePhoneCall({
phoneNumber: this.data.orderInfo.ownerPhone
})
}
},
onShareAppMessage: function () {
var title = ''
if(this.data.orderInfo.locCityName){
if (this.data.orderInfo.locCityName) {
title = this.data.orderInfo.locProvinceName + this.data.orderInfo.locCityName
}
title += '采购' + this.data.orderInfo.secondCategoryName
var imageUrl = '/assets/image/icon_logo.png'
if(this.data.orderInfo.imgList && this.data.orderInfo.imgList.length > 0){
if (this.data.orderInfo.imgList && this.data.orderInfo.imgList.length > 0) {
imageUrl = this.data.orderInfo.imgList[0]
}
return {
@ -107,5 +127,23 @@ Page({
imageUrl: imageUrl,
success: function (res) {}
}
}
},
// 分享至朋友圈
onShareTimeline() {
var title = ''
if (this.data.orderInfo.locCityName) {
title = this.data.orderInfo.locProvinceName + this.data.orderInfo.locCityName
}
title += '采购' + this.data.orderInfo.secondCategoryName
var imageUrl = '/assets/image/icon_logo.png'
if (this.data.orderInfo.imgList && this.data.orderInfo.imgList.length > 0) {
imageUrl = this.data.orderInfo.imgList[0]
}
return {
title: title,
path: 'pages/index/index?url=/pages/purchase/detail/index&key=id&value=' + this.data.orderInfo.productId,
imageUrl: imageUrl,
success: function (res) {}
}
},
})
Loading…
Cancel
Save