Browse Source

no message

featrue/v4.1
xpz2018 5 years ago
parent
commit
17553a16d9
29 changed files with 342 additions and 548 deletions
  1. 75
      pages/adress/create/index.js
  2. 46
      pages/adress/list/index.js
  3. 22
      pages/api/payment.js
  4. 20
      pages/api/recycle.js
  5. 34
      pages/api/saas.js
  6. 16
      pages/api/user.js
  7. 66
      pages/api/ztb.js
  8. 11
      pages/balance/detail/index.js
  9. 10
      pages/balance/fragment/index.js
  10. 15
      pages/bank/bill-detail/index.js
  11. 14
      pages/bank/bill/index.js
  12. 39
      pages/bank/create/index.js
  13. 25
      pages/bank/edit/index.js
  14. 49
      pages/bank/index/index.js
  15. 42
      pages/bank/password/index.js
  16. 12
      pages/bank/vindex/index.js
  17. 6
      pages/home/authory/index.js
  18. 33
      pages/home/idcard/index.js
  19. 15
      pages/home/info/index.js
  20. 45
      pages/home/mobile/index.js
  21. 39
      pages/home/password/index.js
  22. 1
      pages/login/index.js
  23. 93
      pages/message/index/index.js
  24. 38
      pages/morder/create/index.js
  25. 71
      pages/morder/detail/index.js
  26. 10
      pages/morder/index/index.js
  27. 16
      pages/paper/index.js
  28. 16
      pages/payment/index.js
  29. 11
      pages/ztbvip/index.js

75
pages/adress/create/index.js

@ -1,5 +1,5 @@
// pages/shop/apply/index.js
const request = require('../../../utils/request')//导入模块
import { getAddressInfo, deleteAddress, createAddress, updateAddress } from "../../api/ztb"
const util = require('../../../utils/util')
import regions from '../../../utils/region'
const app = getApp()
@ -46,11 +46,9 @@ Page({
this.getAdressDetails(options.shippingAddressId)
}
},
bindinput: function(e){
this.data.form[e.target.id] = e.detail.value
},
showRegion: function(){
if(this.data.disabled){
return
@ -97,27 +95,22 @@ Page({
* 新增收获地址列表
*/
createAdress:function(){
if(this.data.type==1){
request.post('/recycle-service/create/shipping-address',this.data.form).then(res => {
if(res.code==0){
util.showToast('新增地址成功')
wx.navigateBack()
}else{
util.showToast('新增地址失败!原因:'+res.message)
}
}).catch((e) => {
console.log(e)
wx.showLoading({ title: '处理中', mask: true })
if(this.data.type == 1){
createAddress(this.data.form).then(res => {
wx.hideLoading()
util.showBackToast('新增地址成功')
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}else if(this.data.type==0){
request.post('/recycle-service/update/shipping-address',this.data.form).then(res => {
if(res.code==0){
util.showToast('编辑地址成功')
wx.navigateBack()
}else{
util.showToast('编辑地址失败!原因:'+res.message)
}
}).catch((e) => {
console.log(e)
updateAddress('/recycle-service/update/shipping-address',this.data.form).then(res => {
wx.hideLoading()
util.showBackToast('编辑地址成功')
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
}
},
@ -125,26 +118,22 @@ Page({
* 获取收货地址详情
*/
getAdressDetails:function(shippingAddressId){
request.get('/recycle-service/get/shipping-address-details/'+shippingAddressId).then(res => {
if(res.code==0){
this.setData({
// ['form.areaStr']: e.detail.options.map((n) => n.label).join(' '),
// region: e.detail.value
['form.receiver']:res.data.receiver,
['form.phone']:res.data.phone,
['form.details']:res.data.details,
['form.isDefault']:res.data.isDefault,
['form.districtId']:res.data.districtId,
['form.shippingAddressId']:res.data.shippingAddressId,
checked: res.data.isDefault+'',
region:[res.data.provinceId, res.data.cityId, res.data.districtId]
})
this.cascaderView.getCurrentOptions(this.data.region, true)
}else{
util.showToast('获取地址详情失败')
}
}).catch((e) => {
console.log(e)
getAddressInfo(shippingAddressId).then(res => {
this.setData({
// ['form.areaStr']: e.detail.options.map((n) => n.label).join(' '),
// region: e.detail.value
['form.receiver']:res.data.receiver,
['form.phone']:res.data.phone,
['form.details']:res.data.details,
['form.isDefault']:res.data.isDefault,
['form.districtId']:res.data.districtId,
['form.shippingAddressId']:res.data.shippingAddressId,
checked: res.data.isDefault+'',
region:[res.data.provinceId, res.data.cityId, res.data.districtId]
})
this.cascaderView.getCurrentOptions(this.data.region, true)
}).catch(err => {
util.showToast(err)
})
},
onRegionInit: function (e) {
@ -159,7 +148,7 @@ Page({
this.setData({ modalName: null })
},
sureModal(e){
request.post('/recycle-service/delete/shipping-address',{shippingAddressId:this.data.shippingAddressId}).then(res => {
deleteAddress({shippingAddressId:this.data.shippingAddressId}).then(res => {
if(res.code==0){
util.showToast('删除地址成功!')
this.setData({ modalName: null })

46
pages/adress/list/index.js

@ -1,9 +1,8 @@
// pages/adress/list/index.js
const request = require('../../../utils/request')//导入模块
import { getAddressList } from "../../api/ztb"
const event = require('../../../utils/event.js')
Page({
/**
* 页面的初始数据
*/
@ -17,28 +16,28 @@ Page({
*/
onLoad: function (options) {
if(options.type){
this.setData({
type: Number(options.type)
})
this.data.type = Number(options.type)
}
},
/**
* 生命周期函数--监听页面显示
*/
onShow: function () {
this.getAdressList()
wx.showLoading({ title: '加载中', mask: true })
getAddressList().then(res => {
this.setData({ adressList:res.data })
wx.hideLoading()
}).catch((e) => {
wx.hideLoading()
})
},
lookItem: function (e) {
var item = this.data.adressList[e.currentTarget.dataset.index]
if(this.data.type == 1){
event.emit('EventMessage', { what: 301, obj: item, desc: 'AddressChoose' })
wx.navigateBack({ delta: 1 })
} else {
wx.navigateTo({
url: '/pages/adress/create/index?type=0&shippingAddressId='+ item.shippingAddressId
})
wx.navigateTo({ url: '/pages/adress/create/index?type=0&shippingAddressId='+ item.shippingAddressId })
}
},
@ -47,33 +46,12 @@ Page({
*/
toEdit: function (e) {
var item = this.data.adressList[e.currentTarget.dataset.index]
wx.navigateTo({
url: '/pages/adress/create/index?type=0&shippingAddressId='+ item.shippingAddressId
})
wx.navigateTo({ url: '/pages/adress/create/index?type=0&shippingAddressId='+ item.shippingAddressId })
},
/**
* 跳转至新增地址
*/
toCreate: function () {
wx.navigateTo({
url: '/pages/adress/create/index?type=1'
})
},
/**
* 获取地址列表
*/
getAdressList:function(){
wx.showLoading({
title: '加载中',
mask: true
})
request.get('/recycle-service/get/shipping-address-list').then(res => {
this.setData({
adressList:res.data
})
wx.hideLoading()
}).catch((e) => {
wx.hideLoading()
})
wx.navigateTo({ url: '/pages/adress/create/index?type=1' })
}
})

22
pages/api/payment.js

@ -5,16 +5,24 @@ import { mGet, mPost } from "./request"
const app = getApp()
const pconfig = {
baseUrl: app.release ? `https://psc.qniao.cn` : `http://psc-dev.qniao.cn`
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `https://api-client-ztb-dev.qniao.cn`
}
// *******************************************************************账户业务***********************************************************
// /credit/get/self-enterprise-credit-by-enterprise-id查看个人的采购额度recycle
const getCreditInfo = (params) => mGet(`/payment-settlement-center/credit/get/self-enterprise-credit-by-enterprise-id`, params, pconfig)
const paymentInfo = (params) => mPost(`/payment-settlement-center/pay`, params, pconfig)
const getBankcardInfo = (cardNo) => mGet(`/payment-settlement-center/bankcard/bankcard/home/${cardNo}`, null, pconfig)
const ocrBankcard = (params) => mPost(`/payment-settlement-center/bankcard/get/ocr/bankcard`, params, pconfig)
const verifyBankcard = (params) => mPost(`/payment-settlement-center/bankcard/post/verify/bankverify`, params, pconfig)
const getBankCardList = () => mGet(`/payment-settlement-center/bankcard/getBankCardList`, null, pconfig)
const deleteBankcard = (id) => mPost(`/payment-settlement-center/bankcard/delete/bankCard/${id}`, null, pconfig)
const getTradeOrder = (id) => mGet(`/payment-settlement-center/get/payment-order/by-trade-order-id/${id}`, null, pconfig)
const paymentFor = (params) => mPost(`/payment-settlement-center/pay`, params, pconfig)
export {
pconfig,
getCreditInfo,
paymentInfo
getBankcardInfo,
ocrBankcard,
verifyBankcard,
getBankCardList,
deleteBankcard,
getTradeOrder,
paymentFor
}

20
pages/api/recycle.js

@ -1,20 +0,0 @@
/**
* Copyright © 2020-present LiuDanYang. All rights Reserved.
*/
import { mGet, mPost } from "./request"
const app = getApp()
const rconfig = {
baseUrl: app.release ? `https://psc.qniao.cn` : `http://psc-dev.qniao.cn`
}
// *******************************************************************账户业务***********************************************************
// /credit/get/self-enterprise-credit-by-enterprise-id查看个人的采购额度
const getCreditInfo = (params) => mGet(`/payment-settlement-center/credit/get/self-enterprise-credit-by-enterprise-id`, params, rconfig)
const paymentInfo = (params) => mPost(`/payment-settlement-center/pay`, params, rconfig)
export {
rconfig,
getCreditInfo,
paymentInfo
}

34
pages/api/saas.js

@ -0,0 +1,34 @@
/**
* Copyright © 2020-present LiuDanYang. All rights Reserved.
*/
import { mGet, mPost, mDelete } from "./request"
const app = getApp()
const sconfig = {
baseUrl: app.release ? `https://api-client-ztb.qniao.cn` : `https://api-client-ztb-dev.qniao.cn`
}
// *******************************************************************账户业务***********************************************************
const getFinanceLog = (id) => mGet(`/saas-user/account/financeLog/${id}`, null, sconfig)
const getFinanceList = (params) => mGet(`/saas-user/account/financeLog/list`, params, sconfig)
const sendVerifyCode = (params) => mPost(`/saas-user/user/sendVerifyCode`, params, sconfig)
const checkBankcard = (cardNo) => mGet(`/saas-user/account/bankcard/home/${cardNo}`, null, sconfig)
const addBankCard = (params) => mPost(`/saas-user/account/addBankCard`, params, sconfig)
const getBankCardList = () => mGet(`/saas-user/account/getBankCardList`, null, sconfig)
const deleteBankCard = (id, params) => mDelete(`/saas-user/account/bankCard/${id}`, params, sconfig)
const checkPayPassword = () => mGet(`/saas-user/account/checkPayPassword`, null, sconfig)
const bankCardDefault = (id) => mPost(`/saas-user/account/bankCardDefault/${id}`, null, sconfig)
const udpatePayPassword = (params) => mPost(`/saas-user/user/udpatePayPassword`, params, sconfig)
export {
sconfig,
getFinanceLog,
getFinanceList,
sendVerifyCode,
checkBankcard,
addBankCard,
getBankCardList,
deleteBankCard,
checkPayPassword,
bankCardDefault,
udpatePayPassword
}

16
pages/api/user.js

@ -1,7 +1,7 @@
/**
* Copyright © 2020-present LiuDanYang. All rights Reserved.
*/
import { mGet, mPost, mDelete } from "./request"
import { mGet, mPost } from "./request"
const util = require('../../utils/util')
const storage = require('../../utils/storage')
const app = getApp()
@ -9,22 +9,13 @@ const app = getApp()
const config = {
baseUrl: app.release ? 'https://uec.qniao.cn' : 'https://uec-dev.qniao.cn'
}
// /uec/get/wechat-applet-session
const wechatApplet = (params) => mPost('/uec/get/wechat-applet-session', params, config)
// /uec/authorize/by-captcha
const loginCaptcha = (params) => mPost(`/uec/authorize/by-captcha`, params, config)
// /uec/get/auth-captcha
const postCaptcha = (params) => mPost(`/uec/get/auth-captcha`, params, config)
const getUserInfo = (params) => mGet('/uec/get/user-info', params, config)
const getAuthSession = () => mGet('/uec/create/identity-auth-session', null, config)
const certificateImage = (params) => mPost('/uec/recognize/certificate-img', params, config)
const certificateIdentity = (params) => mPost('/uec/identify/identity', params, config)
const getAddressList = () => mGet(`/uec/get/enterprise-shipping-address-list/by-userId`, null, config)
const saveAddress = (params) => mPost(`/uec/save/enterprise-shipping-address`, params, config)
// /uec/delete/enterprise-shipping-address/{id}
const deleteAddress = (id) => mDelete(`/uec/delete/enterprise-shipping-address/${id}`, null, config)
// ****************************************************************************************************************************************
// /authorize/by-wechat-applet小程序登录
@ -189,8 +180,5 @@ export {
certificateImage,
certificateIdentity,
phoneWechat,
loginWechat,
getAddressList,
saveAddress,
deleteAddress
loginWechat
}

66
pages/api/ztb.js

@ -82,8 +82,39 @@ const getUserProduct = (id) => mGet(`/recycle-service/get/user-product/${id}`, n
const confirmBidding = (params) => mPost(`/recycle-service/confirm/bidding`, params, zconfig)
const cancelBidding = (id) => mPost(`/recycle-service/cancel/bidding-activity/${id}`, null, zconfig)
const getMyBidding = (id) => mGet(`/recycle-service/get/my-bidding/${id}`, null, zconfig)
// /recycle-service/delete/shipping-address
const deleteAddress = (params) => mPost(`/recycle-service/delete/shipping-address`, params, zconfig)
const createAddress = (params) => mPost(`/recycle-service/create/shipping-address`, params, zconfig)
const updateAddress = (params) => mPost(`/recycle-service/update/shipping-address`, params, zconfig)
const getAddressInfo = (id) => mGet(`/recycle-service/get/shipping-address-details/${id}`, null, zconfig)
const getAddressList = () => mGet(`/recycle-service/get/shipping-address-list`, null, zconfig)
const getBillList = () => mGet(`/recycle-service/get/bill-list`, null, zconfig)
const getBillDetail = (id) => mGet(`/recycle-service/get/bill-detail/${id}`, null, zconfig)
const sendCaptcha = (params) => mPost(`/recycle-service/send/captcha`, params, zconfig)
const modifyMobile = (params) => mPost(`/recycle-service/user/modify/mobile`, params, zconfig)
const modifyMemberInfo = (params) => mPost(`/recycle-service/user/update/member-info`, params, zconfig)
const setPassword = (params) => mPost(`/recycle-service/user/set/sign-in-password`, params, zconfig)
const resetPassword = (params) => mPost(`/user-centre/commonLogin/resetPassword`, params, zconfig)
const getMessageList = (params) => mGet(`/message-center/message/get/message-list`, params, zconfig)
const getNotificationList = (params) => mGet(`/message-center/message/get/notification-list`, params, zconfig)
const readMessage = (params) => mPost(`/message-center/message/read`, params, zconfig)
const getMessageNumber = () => mGet(`/message-center/message/get/unread-number`, null, zconfig)
const getMemberExpenseList = () => mGet(`/recycle-service/member/get/member-expense-list`, null, zconfig)
const getMemberInfo = () => mGet(`/recycle-service/user/get/member-info`, null, zconfig)
const buyMemberInfo = (params) => mPost(`/recycle-service/member/buy/member`, params, zconfig)
const createTradeOrder = (params) => mPost(`/recycle-service/create/order-trade`, params, zconfig)
const getStoreOrderInfo = (id) => mGet(`/recycle-service/get/store-order-trade-details/${id}`, null, zconfig)
const getUserOrderInfo = (id) => mGet(`/recycle-service/get/user-order-trade-details/${id}`, null, zconfig)
const uploadStoreOrder = (params) => mPost(`/recycle-service/upload/store-order-trade`, params, zconfig)
const payOffline = (params) => mPost(`/recycle-service/order-trade/pay/offline`, params, zconfig)
const confirmUserOrder = (params) => mPost(`/recycle-service/confirm/user-order-data`, params, zconfig)
const getCancelUserOrder = (id) => mGet(`/recycle-service/cancel/user-order-trade/${id}`, null, zconfig)
const confirmOrderTrade = (params) => mPost(`/recycle-service/confirm/user-order-trade`, params, zconfig)
const returnOrderTrade = (params) => mPost(`/recycle-service/return/user-order-trade`, params, zconfig)
const confirmStorerOrder = (params) => mPost(`/recycle-service/confirm/store-order-trade`, params, zconfig)
const applyUserOrder = (params) => mPost(`/recycle-service/apply/user-order-trade-deduction`, params, zconfig)
const getUserOrderList = (params) => mGet(`/recycle-service/get/user-order-trade-list`, params, zconfig)
export {
zconfig,
@ -141,5 +172,36 @@ export {
getUserProduct,
confirmBidding,
cancelBidding,
getMyBidding
getMyBidding,
deleteAddress,
createAddress,
updateAddress,
getAddressInfo,
getAddressList,
getBillList,
getBillDetail,
sendCaptcha,
modifyMobile,
modifyMemberInfo,
setPassword,
resetPassword,
getMessageList,
getNotificationList,
readMessage,
getMessageNumber,
getMemberExpenseList,
getMemberInfo,
buyMemberInfo,
createTradeOrder,
getStoreOrderInfo,
getUserOrderInfo,
uploadStoreOrder,
payOffline,
confirmUserOrder,
getCancelUserOrder,
confirmOrderTrade,
returnOrderTrade,
confirmStorerOrder,
applyUserOrder,
getUserOrderList
}

11
pages/balance/detail/index.js

@ -1,5 +1,6 @@
// pages/balance/detail/index.js
const request = require('../../../utils/request'); //导入模块
import { getFinanceLog } from "../../api/saas"
const util = require('../../../utils/util')
Page({
/**
@ -13,14 +14,10 @@ Page({
*/
onLoad: function (options) {
wx.showLoading({ title: '加载中', mask: true })
request.get('/saas-user/account/financeLog/' + options.id).then(result => {
this.setData({
dataDetails: result.data,
type: Number(options.type)
})
getFinanceLog(options.id).then(result => {
this.setData({ dataDetails: result.data, type: Number(options.type) })
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})

10
pages/balance/fragment/index.js

@ -1,5 +1,5 @@
// pages/balance/fragment/index.js
const request = require('../../../utils/request'); //导入模块
import { getFinanceList } from "../../api/saas"
Component({
options: {
@ -44,9 +44,7 @@ Component({
this.data.form.direction = this.data.direction
this.data.requesting = true
wx.showLoading({ title: '加载中', mask: true })
// /product/cheapList特价产品列表
request.get('/saas-user/account/financeLog/list', this.data.form).then(result => {
//成功回调
getFinanceList(this.data.form).then(result => {
this.setData({ requesting: false, loading: false })
if (result.data.records.length) {
var respList = result.data.records
@ -73,9 +71,7 @@ Component({
})
},
lookItem: function(e){
wx.navigateTo({
url: '/pages/balance/detail/index?id=' + e.currentTarget.id + '&type=' + this.data.direction
})
wx.navigateTo({ url: '/pages/balance/detail/index?id=' + e.currentTarget.id + '&type=' + this.data.direction })
}
}
})

15
pages/bank/bill-detail/index.js

@ -1,5 +1,5 @@
// pages/bank/bill-detail/index.js
const request = require('../../../utils/request')
import { getBillDetail } from "../../api/ztb"
const util = require('../../../utils/util')
Page({
@ -16,19 +16,12 @@ Page({
*/
onLoad: function (options) {
if (options.id) {
wx.showLoading({
title: '加载中',
mask: true
})
wx.showLoading({ title: '加载中', mask: true })
this.data.requesting = true
request.get('/recycle-service/get/bill-detail/' + options.id).then(result => {
//成功回调
this.setData({
billInfo: result.data
})
getBillDetail(options.id).then(result => {
this.setData({ billInfo: result.data })
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})

14
pages/bank/bill/index.js

@ -1,5 +1,5 @@
// pages/bank/bill/index.js
const request = require('../../../utils/request')
import { getBillList } from "../../api/ztb"
const util = require('../../../utils/util')
const app = getApp()
@ -23,9 +23,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
height: app.globalData.fragmentHeight
})
this.setData({ height: app.globalData.fragmentHeight })
this.fetchBillList()
},
onRefreshList: function () {
@ -44,13 +42,9 @@ Page({
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({
requesting: true
})
this.setData({ requesting: true })
}
// /product/cheapList特价产品列表
request.get('/recycle-service/get/bill-list', this.data.form).then(result => {
//成功回调
getBillList(this.data.form).then(result => {
if (result.data && result.data.records && result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`

39
pages/bank/create/index.js

@ -1,6 +1,7 @@
// pages/bank/edit/index.js
const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util');
import { getBankcardInfo, ocrBankcard, verifyBankcard } from "../../api/payment"
import { sendCaptcha } from "../../api/ztb"
const util = require('../../../utils/util')
import { $wuxCountDown } from '../../../components/index'
const app = getApp()
@ -66,17 +67,7 @@ Page({
}
},
checkCardNo: function(cardNo){
request.get('/payment-settlement-center/bankcard/bankcard/home/' + cardNo).then(result => {
// if (result.data.isExist == 1) {
// util.showToast('该银行卡已存在!')
// } else {
// this.setData({
// ['form.cardName']: result.data.bank,
// bankName: result.data.bankName,
// ['form.cardType']: result.data.cardType,
// cardType: this.getCardType(result.data.cardType)
// })
// }
getBankcardInfo(cardNo).then(result => {
this.setData({
['form.cardName']: result.data.bank,
bankName: result.data.bankName,
@ -111,14 +102,6 @@ Page({
util.showToast('请输入银行卡卡号')
return
}
// if (util.isEmpty(this.data.form.idno)) {
// util.showToast('请输入身份证号码')
// return
// }
// if (util.checkId(this.data.form.idno).status == 0) {
// util.showToast('身份证号码有误')
// return
// }
if (util.isEmpty(this.data.form.phone)) {
util.showToast('请输入手机号码')
return
@ -128,15 +111,9 @@ Page({
return
}
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service//send/captcha', {
account: this.data.form.phone,
accountType: 'MOBILE',
purpose: 'RECYCLE_CLIENT_BIND_BANK_CARD'
}).then(result => {
sendCaptcha({ account: this.data.form.phone, accountType: 'MOBILE', purpose: 'RECYCLE_CLIENT_BIND_BANK_CARD' }).then(result => {
wx.hideLoading()
this.setData({
codeEnable: false
})
this.setData({ codeEnable: false })
util.showToast('验证码已经发送')
this.second = new $wuxCountDown({
date: +(new Date) + 60000,
@ -192,7 +169,7 @@ Page({
return
}
wx.showLoading({ title: '处理中', mask: true })
request.post('/payment-settlement-center/bankcard/post/verify/bankverify', this.data.form).then(res => {
verifyBankcard(this.data.form).then(res => {
wx.hideLoading()
if(res.data.trxstatus == 1){
if(this.data.form.type == 2){
@ -232,7 +209,7 @@ Page({
},
ocrBankcard: function(base64Image){
wx.showLoading({ title: '处理中', mask: true })
request.post('/payment-settlement-center/bankcard/get/ocr/bankcard', {base64Image}).then(res => {
ocrBankcard({base64Image}).then(res => {
wx.hideLoading()
this.setData({ ['form.cardNo']: res.data.card_num })
this.checkCardNo(res.data.card_num)

25
pages/bank/edit/index.js

@ -1,6 +1,6 @@
// pages/bank/edit/index.js
const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util');
import { checkBankcard, sendVerifyCode, addBankCard } from "../../api/saas"
const util = require('../../../utils/util')
import { $wuxCountDown } from '../../../components/index'
Page({
@ -25,13 +25,6 @@ Page({
codeEnable: true,
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
/**
* 生命周期函数--监听页面初次渲染完成
*/
@ -55,7 +48,7 @@ Page({
}
} else if (e.target.id == 'cardNo' && !util.isEmpty(e.detail.value)) {
if (!util.isEmpty(e.detail.value)) {
request.get('/saas-user/account/bankcard/home/' + e.detail.value).then(result => {
checkBankcard(e.detail.value).then(result => {
if (result.data.isExist == 1) {
util.showToast('该银行卡已存在!')
} else {
@ -121,15 +114,9 @@ Page({
return
}
wx.showLoading({ title: '处理中', mask: true })
request.post('/saas-user/user/sendVerifyCode', {
phone: this.data.form.cardMobile,
codeType: '6',
type: 'yzmjc'
}).then(result => {
sendVerifyCode({ phone: this.data.form.cardMobile, codeType: '6', type: 'yzmjc' }).then(result => {
wx.hideLoading()
this.setData({
codeEnable: false
})
this.setData({ codeEnable: false })
util.showToast('验证码已经发送')
this.second = new $wuxCountDown({
date: +(new Date) + 60000,
@ -189,7 +176,7 @@ Page({
return
}
wx.showLoading({ title: '处理中', mask: true })
request.post('/saas-user/account/addBankCard', this.data.form).then(res => {
addBankCard(this.data.form).then(res => {
wx.hideLoading()
util.showBackToast('添加成功')
}).catch(error => {

49
pages/bank/index/index.js

@ -1,6 +1,6 @@
// pages/bank/index/index.js
import { getBankCardList, deleteBankCard, checkPayPassword, bankCardDefault } from "../../api/saas"
import { $wuxKeyBoard, $wuxDialog } from '../../../components/index'
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
const app = getApp()
@ -14,37 +14,26 @@ Page({
bankList: []
},
onShow: function () {
this.checkPayPassword()
checkPayPassword().then(res => {
this.data.isSetPwd = 1
}).catch(err => {
this.data.isSetPwd = -1
})
this.fetchBankCardList()
},
/**
* 获取用户银行卡列表
*/
fetchBankCardList: function () {
wx.showLoading({
title: '加载中',
mask: true
})
request.get('/saas-user/account/getBankCardList').then(result => {
this.setData({
bankList: result.data
})
wx.showLoading({ title: '加载中', mask: true })
getBankCardList().then(result => {
this.setData({ bankList: result.data })
wx.hideLoading()
}).catch(err => {
wx.hideLoading()
util.showToast(err)
})
},
/**
* 检测是否设置支付密码
*/
checkPayPassword() {
request.get('/saas-user/account/checkPayPassword').then(res => {
this.data.isSetPwd = 1
}).catch(err => {
this.data.isSetPwd = -1
})
},
showActionSheet(e) {
this.data.nowIndex = e.currentTarget.dataset.index
if (this.data.nowIndex < 0) {
@ -80,11 +69,8 @@ Page({
},
setDefault: function (id) {
var item = this.data.bankList[this.data.nowIndex]
wx.showLoading({
title: '处理中',
mask: true
})
request.put('/saas-user/account/bankCardDefault/' + item.id).then(res => {
wx.showLoading({ title: '处理中', mask: true })
bankCardDefault(item.id).then(res => {
for (let index = 0; index < this.data.bankList.length; index++) {
if(index == this.data.nowIndex){
this.data.bankList[index].isDefault = 1
@ -132,20 +118,13 @@ Page({
}
},
postUnbindCard: function (pwd) {
wx.showLoading({
title: '处理中',
mask: true
})
wx.showLoading({ title: '处理中', mask: true })
var item = this.data.bankList[this.data.nowIndex]
request.delete('/saas-user/account/bankCard/' + item.id, {
password: pwd
}).then(res => {
deleteBankCard(item.id, { password: pwd }).then(res => {
wx.hideLoading()
util.showToast('解除成功')
this.data.bankList.splice(this.data.nowIndex, 1);
this.setData({
bankList: this.data.bankList
})
this.setData({ bankList: this.data.bankList })
}).catch(err => {
wx.hideLoading()
util.showToast(err)

42
pages/bank/password/index.js

@ -1,5 +1,6 @@
// pages/bank/password/index.js
const request = require('../../../utils/request') //导入模块
import { udpatePayPassword } from "../../api/saas"
import { sendCaptcha } from "../../api/ztb"
const util = require('../../../utils/util')
const md5 = require('../../../utils/md5')
import { $wuxCountDown } from '../../../components/index'
@ -19,14 +20,6 @@ Page({
},
requesting: false
},
/**
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
},
bindForm: function (e) {
this.data.form[e.target.id] = e.detail.value
},
@ -36,34 +29,20 @@ Page({
return
}
if (this.second && this.second.interval) return !1
wx.showLoading({
title: '正在获取',
mask: true
})
wx.showLoading({ title: '正在获取', mask: true })
// /login/h5/mobile/send_sms_code 发送验证码
request.post('/recycle-service/send/captcha', {
account: this.data.form.mobile,
accountType: 'MOBILE',
purpose: 'RECYCLE_CLIENT_UPDATE_PAY_PASSWORD'
}).then(result => {
sendCaptcha({ account: this.data.form.mobile, accountType: 'MOBILE', purpose: 'RECYCLE_CLIENT_UPDATE_PAY_PASSWORD' }).then(result => {
wx.hideLoading()
this.setData({
codeEnable: false
})
this.setData({ codeEnable: false })
util.showToast('验证码已经发送')
this.wuxCountDown = new $wuxCountDown({
date: +(new Date) + 60000,
onEnd() {
this.setData({
second: '重新获取验证码',
codeEnable: true
})
this.setData({ second: '重新获取验证码', codeEnable: true })
},
render(date) {
const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
date.sec !== 0 && this.setData({
second: sec,
})
date.sec !== 0 && this.setData({ second: sec })
},
})
}).catch(error => {
@ -89,12 +68,9 @@ Page({
return
}
this.data.form.verifyCode = this.data.form.captcha
wx.showLoading({
title: '处理中',
mask: true
})
wx.showLoading({ title: '处理中', mask: true })
this.data.requesting = true
request.post('/saas-user/user/udpatePayPassword', this.data.form).then(res => {
udpatePayPassword(this.data.form).then(res => {
wx.hideLoading()
util.showBackToast('设置成功')
}).catch(error => {

12
pages/bank/vindex/index.js

@ -1,6 +1,6 @@
// pages/bank/index/index.js
import { getBankCardList, deleteBankcard } from "../../api/payment"
import { $wuxDialog } from '../../../components/index'
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
Page({
@ -13,14 +13,8 @@ Page({
bankList: []
},
onShow: function () {
this.fetchBankCardList()
},
/**
* 获取用户银行卡列表
*/
fetchBankCardList: function () {
wx.showLoading({ title: '加载中', mask: true })
request.get('/payment-settlement-center/bankcard/getBankCardList').then(result => {
getBankCardList().then(result => {
this.setData({ bankList: result.data })
wx.hideLoading()
}).catch(err => {
@ -60,7 +54,7 @@ Page({
unbindCard: function () {
wx.showLoading({ title: '处理中', mask: true })
var item = this.data.bankList[this.data.nowIndex]
request.post('/payment-settlement-center/bankcard/delete/bankCard/' + item.id).then(res => {
deleteBankcard(item.id).then(res => {
wx.hideLoading()
util.showToast('解除成功')
this.data.bankList.splice(this.data.nowIndex, 1);

6
pages/home/authory/index.js

@ -1,7 +1,7 @@
// pages/home/authory/index.js
const request = require('../../../utils/request'); //导入模块
import { certificateIdentity} from "../../api/user"
const util = require('../../../utils/util')
const event = require('../../../utils/event');
const event = require('../../../utils/event')
const app = getApp()
Page({
@ -49,7 +49,7 @@ Page({
// /front/customer/personalAuth 个人会员认证
wx.showLoading({ title: '处理中', mask: true })
this.data.form.identityAuthToken = this.data.form.token
request.post('/recycle-service/identity-auth/identify/identity', this.data.form).then(res => {
certificateIdentity(this.data.form).then(res => {
wx.hideLoading()
app.globalData.userInfo.isAuth = 1
this.data.auth = true

33
pages/home/idcard/index.js

@ -1,5 +1,5 @@
// pages/home/authory/index.js
const request = require('../../../utils/request') //导入模块
import { getAuthSession, certificateImage } from "../../api/user"
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
@ -15,19 +15,14 @@ Page({
onLoad: function (options) {
event.on('EventMessage', this, this.onEvent)
this.resetForm()
},
/**
* 生命周期函数--监听页面加载
*/
resetForm: function(){
try {
wx.removeStorageSync('identityAuthToken')
} catch (e) {
// Do something when catch error
}
wx.showLoading({ title: '加载中', mask: true })
getAuthSession().then(result => {
wx.hideLoading()
this.data.form.identityAuthToken = result.data.token
}).catch(error => {
wx.hideLoading()
})
},
onEvent: function (message) {
if (message.what == 82) {
wx.navigateBack()
@ -42,9 +37,8 @@ Page({
util.showToast('请上传身份证背面照片')
return
}
// /front/customer/personalAuth 个人会员认证
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service/identity-auth/recognize/id-card', this.data.form).then(result => {
certificateImage(this.data.form).then(result => {
wx.hideLoading()
var tokenJson = JSON.stringify({token: result.data.identityAuthToken, idCardNo: result.data.idCardNo, realName: result.data.realName})
wx.setStorageSync('identityAuthToken', tokenJson)
@ -94,17 +88,12 @@ Page({
urlList.push(this.data.imgList[i])
}
}
wx.previewImage({
urls: urlList,
current: e.currentTarget.dataset.url
})
wx.previewImage({ urls: urlList, current: e.currentTarget.dataset.url })
},
deleteImg: function(e) {
var index = e.currentTarget.dataset.index
this.data.imgList[index] = null;
this.setData({
imgList: this.data.imgList
})
this.setData({ imgList: this.data.imgList })
},
onUnload: function () {
event.remove('EventMessage', this)

15
pages/home/info/index.js

@ -1,5 +1,5 @@
const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util');
import { getBaseInfo, modifyMemberInfo } from '../../api/ztb'
const util = require('../../../utils/util')
const app = getApp()
Page({
@ -39,7 +39,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
request.get('/recycle-service/user/get/base-info').then(res => {
getBaseInfo().then(res => {
this.setData({
userInfo: res.data,
nickName: res.data.realName,
@ -103,13 +103,9 @@ Page({
},
updateMemberInfo: function(form){
if(form.nickname){
wx.showLoading({
title: '处理中',
mask: true
})
wx.showLoading({ title: '处理中', mask: true })
}
request.post('/recycle-service/user/update/member-info', form).then(result => {
//成功回调
modifyMemberInfo(form).then(result => {
wx.hideLoading()
if(form.nickname){
this.setData({['userInfo.nickname']: form.nickname})
@ -117,7 +113,6 @@ Page({
this.setData({avatarUrl: form.avatar})
}
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})

45
pages/home/mobile/index.js

@ -1,7 +1,8 @@
// pages/home/password/index.js
import { sendCaptcha } from "../../api/ztb"
import { $wuxCountDown } from '../../../components/index'
const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util');
import { modifyMobile } from '../../api/ztb'
const util = require('../../../utils/util')
const app = getApp()
Page({
@ -27,9 +28,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
mobile: app.globalData.userInfo.mobile
})
this.setData({ mobile: app.globalData.userInfo.mobile })
},
bindForm: function (e) {
this.data.form[e.target.id] = e.detail.value
@ -62,34 +61,20 @@ Page({
return
}
if (this.second && this.second.interval) return !1
wx.showLoading({
title: '正在获取',
mask: true
})
wx.showLoading({ title: '正在获取', mask: true })
// /login/h5/mobile/send_sms_code 发送验证码
request.post('/recycle-service/send/captcha', {
account: this.data.form.newMobile,
accountType: 'MOBILE',
purpose: 'RECYCLE_CLIENT_UPDATE_MOBILE'
}).then(result => {
sendCaptcha({ account: this.data.form.newMobile, accountType: 'MOBILE', purpose: 'RECYCLE_CLIENT_UPDATE_MOBILE' }).then(result => {
wx.hideLoading()
this.setData({
codeEnable: false
})
this.setData({ codeEnable: false })
util.showToast('验证码已经发送')
this.wuxCountDown = new $wuxCountDown({
date: +(new Date) + 60000,
onEnd() {
this.setData({
second: '重新获取验证码',
codeEnable: true
})
this.setData({ second: '重新获取验证码', codeEnable: true })
},
render(date) {
const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
date.sec !== 0 && this.setData({
second: sec,
})
date.sec !== 0 && this.setData({ second: sec })
},
})
}).catch(error => {
@ -113,17 +98,9 @@ Page({
util.showToast('请输入验证码')
return
}
wx.showLoading({
title: '处理中',
mask: true
})
var data = {
mobile: this.data.form.newMobile,
captcha: this.data.form.verifyCode
}
wx.showLoading({ title: '处理中', mask: true })
this.data.requesting = true
// /front/customer/mobile修改手机号码
request.post('/recycle-service/user/modify/mobile', data).then(res => {
modifyMobile({ mobile: this.data.form.newMobile, captcha: this.data.form.verifyCode }).then(res => {
wx.hideLoading()
app.globalData.userInfo.mobile = this.data.form.newMobile
util.showBackToast('更换成功')

39
pages/home/password/index.js

@ -1,8 +1,9 @@
// pages/home/password/index.js
import { $wuxCountDown } from '../../../components/index'
const request = require('../../../utils/request'); //导入模块
const util = require('../../../utils/util');
const md5 = require('../../../utils/md5');
import { setPassword } from '../../api/ztb'
const request = require('../../../utils/request') //导入模块
const util = require('../../../utils/util')
const md5 = require('../../../utils/md5')
const app = getApp()
Page({
@ -64,10 +65,7 @@ Page({
return
}
if (this.second && this.second.interval) return !1
wx.showLoading({
title: '正在获取',
mask: true
})
wx.showLoading({ title: '正在获取', mask: true })
// //commonLogin/sendVerifyCode 发送验证码
request.post('/user-centre/commonLogin/sendVerifyCode', {
mobile: this.data.form.mobile,
@ -75,24 +73,17 @@ Page({
type: 'yzmjc'
}).then(result => {
wx.hideLoading()
this.setData({
codeEnable: false
})
this.setData({ codeEnable: false })
util.showToast('验证码已经发送')
this.second = new $wuxCountDown({
date: +(new Date) + 60000,
onEnd() {
this.setData({
second: '重新获取验证码',
codeEnable: true
})
this.setData({ second: '重新获取验证码', codeEnable: true })
},
render(date) {
const sec = this.leadingZeros(date.sec, 2) + ' 秒 '
date.sec !== 0 && this.setData({
second: sec,
})
},
date.sec !== 0 && this.setData({ second: sec })
}
})
}).catch(error => {
wx.hideLoading()
@ -115,16 +106,12 @@ Page({
util.showToast('请输入验证码')
return
}
wx.showLoading({
title: '处理中',
mask: true
})
wx.showLoading({ title: '处理中', mask: true })
this.data.requesting = true
if(this.data.first){
// /user/set/sign-in-password设置登录密码
// var data = { password : md5.hexMD5(this.data.form.password).toUpperCase() }
var data = { password : this.data.form.password }
request.post('/recycle-service/user/set/sign-in-password', data).then(res => {
setPassword({ password : this.data.form.password }).then(res => {
wx.hideLoading()
util.showBackToast('设置成功')
}).catch(error => {
@ -133,9 +120,7 @@ Page({
util.showToast(error)
})
} else {
// /commonLogin/resetPassword 重置密码
// this.data.form.password = md5.hexMD5(this.data.form.password).toUpperCase()
request.post('/user-centre/commonLogin/resetPassword', this.data.form).then(res => {
resetPassword(this.data.form).then(res => {
wx.hideLoading()
util.showBackToast('设置成功')
}).catch(error => {

1
pages/login/index.js

@ -151,7 +151,6 @@ Page({
}
if (this.second && this.second.interval) return !1
wx.showLoading({ title: '正在获取', mask: true })
// /send/captcha 发送验证码
postCaptcha({ verifiableAccount: this.data.form.account, verifiableAccountType: 1, purpose: 1 }).then(result => {
wx.hideLoading()
this.setData({ codeEnable: false })

93
pages/message/index/index.js

@ -1,9 +1,8 @@
// pages/bidding/index/index.js
const request = require('../../../utils/request') //导入模块
import { getMessageList, getNotificationList, readMessage, getMessageNumber } from "../../api/ztb"
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
const urlList = ['/message-center/message/get/message-list', '/message-center/message/get/notification-list']
Page({
/**
@ -29,10 +28,7 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
this.setData({
height: app.globalData.fragmentHeight - 90,
CustomBar: app.globalData.CustomBar
})
this.setData({ height: app.globalData.fragmentHeight - 90, CustomBar: app.globalData.CustomBar })
event.on('EventMessage', this, this.onEvent)
this.fetchMessageNumber()
this.fetchMessageList()
@ -54,7 +50,7 @@ Page({
this.fetchMessageList()
},
fetchMessageNumber: function () {
request.get('/message-center/message/get/unread-number').then(result => {
getMessageNumber().then(result => {
this.setData({
['tabList[0].badge']: result.data.messageNumber,
['tabList[1].badge']: result.data.notificationNumber
@ -70,54 +66,60 @@ Page({
} else {
this.setData({ requesting: true })
}
// /product/cheapList特价产品列表
request.get(urlList[this.data.tabIndex], this.data.form).then(result => {
//成功回调
if (result.data.records.length) {
var respList = result.data.records
let nowList = `messageList[${this.data.messageList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= result.data.pages
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
if(this.data.tabIndex == 0){
getMessageList(this.data.form).then(result => {
this.doResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
} else {
getNotificationList(this.data.form).then(result => {
this.doResult(result)
}).catch(err => {
this.setData({ requesting: false, loading: false })
util.showToast(err)
})
}
},
doResult: function(result){
if (result.data.records.length) {
var respList = result.data.records
let nowList = `messageList[${this.data.messageList.length}]`
var num = this.data.form.pageNum
var finished = this.data.form.pageNum >= result.data.pages
if(this.data.form.pageNum == 1){
this.setData({
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
top: 0,
finished,
requesting: false,
loading: false
})
} else {
this.setData({
finished: true,
[nowList]: respList,
total: result.data.total,
['form.pageNum']: (num + 1),
finished,
requesting: false,
loading: false
})
}
}).catch(err => {
//异常回调
} else {
this.setData({
finished: true,
requesting: false,
loading: false
})
util.showToast(err)
})
}
},
lookItem: function (e) {
var item = this.data.messageList[e.currentTarget.dataset.page][e.currentTarget.dataset.index]
if(item.status == 0){
request.post('/message-center/message/read', { idList: [item.id] }).then(result => {
readMessage({ idList: [item.id] }).then(result => {
//成功回调
var badge = this.data.tabList[this.data.tabIndex].badge - 1
if(badge < 0){
@ -164,15 +166,10 @@ Page({
},
readMessage: function(){
wx.showLoading({ title: '加载中', mask: true })
request.post('/message-center/message/read').then(result => {
//成功回调
this.setData({
['tabList[0].badge']: 0,
['tabList[1].badge']: 0
})
readMessage().then(result => {
this.setData({ ['tabList[0].badge']: 0, ['tabList[1].badge']: 0 })
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})

38
pages/morder/create/index.js

@ -1,12 +1,11 @@
// pages/bidding/create/index.js
const request = require('../../../utils/request') //导入模块
const event = require('../../../utils/event.js')
import { createTradeOrder, getUserProduct, getAddressList } from "../../api/ztb"
const event = require('../../../utils/event')
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const app = getApp()
Page({
/**
* 页面的初始数据
*/
@ -51,11 +50,8 @@ Page({
* 获得商品详情
*/
getProductDetails: function () {
wx.showLoading({
title: '加载中',
mask: true
})
request.get('/recycle-service/get/user-product/' + this.data.productId).then(result => {
wx.showLoading({ title: '加载中', mask: true })
getUserProduct(this.data.productId).then(result => {
if(!this.data.unitPrice){
this.data.unitPrice = result.data.unitPrice
}
@ -128,14 +124,8 @@ Page({
})
}
},
/**
* 获取收货地址列表
*/
/**
* 获取地址列表
*/
getAdressList:function(){
request.get('/recycle-service/get/shipping-address-list').then(res => {
getAddressList().then(res => {
res.data.forEach((element) => {
if(element.isDefault===1){
this.setData({
@ -180,21 +170,11 @@ Page({
quantity: app.globalData.kg ? this.data.quantity : math.times(this.data.quantity, 1000),
shippingAddressId: this.data.shippingAddressId
}
wx.showLoading({
title: '处理中',
mask: true
})
request.post('/recycle-service/create/order-trade', model).then(result => {
wx.showLoading({ title: '处理中', mask: true })
createTradeOrder(model).then(result => {
wx.hideLoading()
event.emit('EventMessage', {
what: 112,
desc: 'OrderCreate'
})
// var url = '/pages/morder/index/index&status=2'
wx.redirectTo({
// url: '/pages/payment/index?type=1&orderId=' + result.data.orderId + '&url=' + url
url: '/pages/morder/detail/index?orderId=' + result.data.orderId
})
event.emit('EventMessage', { what: 112, desc: 'OrderCreate' })
wx.redirectTo({ url: '/pages/morder/detail/index?orderId=' + result.data.orderId })
}).catch(err => {
wx.hideLoading()
util.showToast(err)

71
pages/morder/detail/index.js

@ -1,8 +1,8 @@
// pages/morder/detail/index.js
const request = require('../../../utils/request') //导入模块
import { getStoreOrderInfo, getUserOrderInfo, uploadStoreOrder, payOffline, getCancelUserOrder, returnOrderTrade, confirmUserOrder, confirmStorerOrder, confirmOrderTrade, applyUserOrder } from "../../api/ztb"
const util = require('../../../utils/util')
const math = require('../../../utils/math')
const event = require('../../../utils/event.js')
const event = require('../../../utils/event')
const app = getApp()
Page({
@ -68,30 +68,23 @@ Page({
if(this.data.requesting){
return
}
wx.showLoading({
title: '加载中',
mask: true
})
wx.showLoading({ title: '加载中', mask: true })
if(this.data.type == 1){
this.data.requesting = true
request.get('/recycle-service/get/store-order-trade-details/' + orderId).then(result => {
//成功回调
getStoreOrderInfo(orderId).then(result => {
this.initPoundBO(result.data)
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
this.data.requesting = false
util.showToast(err)
})
} else {
this.data.requesting = true
request.get('/recycle-service/get/user-order-trade-details/' + orderId).then(result => {
//成功回调
getUserOrderInfo(orderId).then(result => {
this.initPoundBO(result.data)
wx.hideLoading()
}).catch(err => {
//异常回调
wx.hideLoading()
this.data.requesting = false
util.showToast(err)
@ -288,8 +281,7 @@ Page({
form.orderPoundBO.grossWeight = math.times(this.data.orderPoundBO.grossWeight, 1000)
form.orderPoundBO.tareWeight = math.times(this.data.orderPoundBO.tareWeight, 1000)
}
request.post('/recycle-service/upload/store-order-trade', form).then(result => {
//成功回调
uploadStoreOrder(form).then(result => {
wx.hideLoading()
util.showToast('您已成功上传磅单信息,请等待买家确认榜单')
this.eventOrder()
@ -327,8 +319,7 @@ Page({
},
paymentOffOrder: function(){
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service/order-trade/pay/offline', { orderId: this.data.orderId }).then(result => {
//成功回调
payOffline({ orderId: this.data.orderId }).then(result => {
wx.hideLoading()
this.eventOrder()
util.showToast('订单支付已处理')
@ -378,13 +369,9 @@ Page({
}
},
confrimInfo(type){
wx.showLoading({
title: '处理中',
mask: true
})
wx.showLoading({ title: '处理中', mask: true })
var form = {orderId: this.data.orderInfo.orderId, type}
request.post('/recycle-service/confirm/user-order-data', form).then(result => {
//成功回调
confirmUserOrder(form).then(result => {
wx.hideLoading()
this.eventOrder()
if(type == 1){
@ -431,12 +418,8 @@ Page({
text: '确定',
type: 'primary',
onTap(e) {
wx.showLoading({
title: '处理中',
mask: true
})
request.get('/recycle-service/cancel/user-order-trade/'+ that.data.orderId).then(result => {
//成功回调
wx.showLoading({ title: '处理中', mask: true })
getCancelUserOrder(that.data.orderId).then(result => {
wx.hideLoading()
that.eventOrder()
util.showToast('订单已经取消')
@ -471,17 +454,12 @@ Page({
},
takeGood: function(){
wx.showLoading({
title: '处理中',
mask: true
})
wx.showLoading({ title: '处理中', mask: true })
var form = { orderId: this.data.orderId }
request.post('/recycle-service/confirm/user-order-trade', form).then(result => {
//成功回调
confirmOrderTrade(form).then(result => {
wx.hideLoading()
this.eventOrder()
util.showToast('收货成功')
// that.fetchOrderInfo(that.data.orderId)
}).catch(err => {
//异常回调
wx.hideLoading()
@ -501,18 +479,12 @@ Page({
text: '确定',
type: 'primary',
onTap(e) {
wx.showLoading({
title: '处理中',
mask: true
})
request.post('/recycle-service/return/user-order-trade', { orderId:that.data.orderId }).then(result => {
//成功回调
wx.showLoading({ title: '处理中', mask: true })
returnOrderTrade({ orderId:that.data.orderId }).then(result => {
wx.hideLoading()
that.eventOrder()
util.showToast('退货申请成功!')
// that.fetchOrderInfo(that.data.orderId)
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})
@ -575,10 +547,7 @@ Page({
return
}
this.hideModal()
wx.showLoading({
title: '处理中',
mask: true
})
wx.showLoading({ title: '处理中', mask: true })
var form = { orderId: this.data.orderId }
form.deductedPoint = Number(this.data.deductedPoint)
if(!app.globalData.kg){
@ -586,20 +555,17 @@ Page({
} else {
form.deductedWeight = Number(this.data.deductedWeight)
}
request.post('/recycle-service/apply/user-order-trade-deduction', form).then(result => {
//成功回调
applyUserOrder(form).then(result => {
wx.hideLoading()
this.eventOrder()
util.showToast('申请扣重扣点成功')
// that.fetchOrderInfo(that.data.orderId)
}).catch(err => {
//异常回调
wx.hideLoading()
util.showToast(err)
})
},
handleDeducted: function(e){
console.log(e)
wx.showLoading({ title: '处理中', mask: true })
var form = { orderId: this.data.orderId, type: 1 }
if(e.currentTarget.id == 'crefuse'){
@ -615,8 +581,7 @@ Page({
form.status = 1
form.type = 2
}
request.post('/recycle-service/confirm/store-order-trade', form).then(result => {
//成功回调
confirmStorerOrder(form).then(result => {
wx.hideLoading()
if(form.status == 0){
util.showToast('已经拒绝')

10
pages/morder/index/index.js

@ -1,5 +1,5 @@
// pages/bidding/index/index.js
const request = require('../../../utils/request') //导入模块
import { getUserOrderList } from "../../api/ztb"
const util = require('../../../utils/util')
const event = require('../../../utils/event.js')
const app = getApp()
@ -62,13 +62,9 @@ Page({
if (this.data.loading) {
this.data.requesting = true
} else {
this.setData({
requesting: true
})
this.setData({ requesting: true })
}
// /product/cheapList特价产品列表
request.get('/recycle-service/get/user-order-trade-list', this.data.form).then(result => {
//成功回调
getUserOrderList(this.data.form).then(result => {
if (result.data.records.length) {
var respList = result.data.records
let nowList = `orderList[${this.data.orderList.length}]`

16
pages/paper/index.js

@ -15,25 +15,11 @@ Page({
* 生命周期函数--监听页面加载
*/
onLoad: function (options) {
// const updateManager = wx.getUpdateManager()
// updateManager.onCheckForUpdate(function (res) {
// // 请求完新版本信息的回调
// console.log('updateManager>>>' + res.hasUpdate)
// // if(!res.hasUpdate){
// // that.checkLogin(options)
// // }
// })
// updateManager.onUpdateReady(function () {
// // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
// updateManager.applyUpdate()
// })
this.setData({safeBottom: app.globalData.safeBottom })
event.on('EventMessage', this, this.onEvent)
// 检查用户是否设置过密码;
if(options.pwd == 0){
wx.navigateTo({
url: '/pages/home/password/index?from=home'
})
wx.navigateTo({ url: '/pages/home/password/index?from=home' })
}
},

16
pages/payment/index.js

@ -1,6 +1,6 @@
const request = require('../../utils/request') //导入模块
import { getTradeOrder } from "../api/payment"
const util = require('../../utils/util')
const event = require('../../utils/event.js')
const event = require('../../utils/event')
const app = getApp()
Page({
@ -40,12 +40,8 @@ Page({
},
fetchPaymentInfo: function (orderId) {
wx.showLoading({ title: '加载中', mask: true })
request.get('/payment-settlement-center/get/payment-order/by-trade-order-id/' + orderId).then(result => {
//成功回调
this.setData({
payment: result.data.amount,
payText: result.data.comment
})
getTradeOrder(orderId).then(result => {
this.setData({ payment: result.data.amount, payText: result.data.comment })
wx.hideLoading()
}).catch(err => {
//异常回调
@ -62,12 +58,10 @@ Page({
}
wx.showLoading({ title: '加载中', mask: true })
this.data.requesting = true
request.post('/payment-settlement-center/pay', this.data.paymodel).then(result => {
//成功回调
paymentFor(this.data.paymodel).then(result => {
wx.hideLoading()
this.requestPayment(result.data.extra)
}).catch(err => {
//异常回调
wx.hideLoading()
this.data.requesting = false
util.showToast(err)

11
pages/ztbvip/index.js

@ -1,5 +1,5 @@
// pages/ztbvip/index.js
const request = require('../../utils/request') //导入模块
import { getBaseInfo, getMemberExpenseList, getMemberInfo, buyMemberInfo } from "../api/ztb"
const util = require('../../utils/util')
const event = require('../../utils/event.js')
const app = getApp()
@ -23,7 +23,7 @@ Page({
*/
onLoad: function (options) {
this.setData({ safeBottom: app.globalData.safeBottom, userInfo: app.globalData.userInfo })
request.get('/recycle-service/member/get/member-expense-list').then(res => {
getMemberExpenseList().then(res => {
this.setData({ iconList: res.data, divIndex:res.data[0].id })
})
this.wuxDialog = this.wuxDialog || this.selectComponent('#wux-dialog')
@ -33,8 +33,7 @@ Page({
return
}
wx.showLoading({ title: '处理中', mask: true })
// /user/userInfo 获取用户信息
request.get('/recycle-service/user/get/base-info').then(result => {
getBaseInfo().then(result => {
app.globalData.userInfo = result.data
this.setData({
// avatarUrl: util.isEmpty(app.globalData.userInfo.avatar) ? '/assets/image/ygImg.png' : app.globalData.userInfo.avatar,
@ -42,7 +41,7 @@ Page({
userName: util.isEmpty(app.globalData.userInfo.realName) ? '' : app.globalData.userInfo.realName.substring(0, 14)
})
})
request.get('/recycle-service/user/get/member-info').then(res => {
getMemberInfo().then(res => {
this.setData({ vipInfo: res.data, ['vipInfo.memberExpiredAt']: res.data.memberExpiredAt.substring(0, 10) })
wx.hideLoading()
}).catch(error => {
@ -82,7 +81,7 @@ Page({
return
}
wx.showLoading({ title: '处理中', mask: true })
request.post('/recycle-service/member/buy/member',{ memberExpenseId: this.data.divIndex }).then(res => {
buyMemberInfo({ memberExpenseId: this.data.divIndex }).then(res => {
wx.hideLoading()
if(res.data.isNeedPay && res.data.orderId){
wx.navigateTo({ url: '/pages/payment/index?type=2&orderId=' + res.data.orderId })

Loading…
Cancel
Save