<template>
|
<view class="main-container user-container">
|
|
<view class="user-utils m-20">
|
|
<view class="user-util m-t-12 flex" @click="goto('/pages/user/user-pwd/user-pwd',true)">
|
<view class="title">修改密码</view>
|
<view class="right-icon">
|
<uni-icons type="right"></uni-icons>
|
</view>
|
</view>
|
|
<!-- <view class="user-util m-t-12 flex" v-if="currentInfo&¤tInfo.id"
|
@click="goto('/pages/user/user-bind-wx/user-bind-wx',true)">
|
<view class="title">绑定当前微信</view>
|
<view class="right-icon">
|
<uni-icons type="right"></uni-icons>
|
</view>
|
</view> -->
|
|
</view>
|
|
</view>
|
</template>
|
|
<script>
|
export default {
|
computed: {
|
},
|
data() {
|
return {
|
CustomBar: uni.getStorageSync('CustomBar'),
|
StatusBar: uni.getStorageSync('StatusBar'),
|
tcode: '',
|
inviterName: '',
|
// StatusBar:0,
|
tel: '19288780072',
|
tj: {},
|
tj_order: {},
|
cacheUserId: '',
|
signToday: false
|
// order_pendding_num: 0,
|
|
};
|
},
|
// #ifndef PUB_CUSTOMER
|
onShareAppMessage() {
|
let that = this;
|
var name = that.currentInfo.customerDTO && currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
|
currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && currentInfo.partnerDTO.name || ''
|
var url =
|
`/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
|
return {
|
title: "花满芫",
|
path: url,
|
}
|
},
|
onShareTimeline() {
|
let that = this;
|
var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
|
that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
|
var url =
|
`/pages/login/supplier-login?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
|
return {
|
title: "花满芫",
|
path: url,
|
}
|
},
|
// #endif
|
// #ifdef PUB_CUSTOMER
|
onShareAppMessage() {
|
let that = this;
|
var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
|
that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
|
var url =
|
`/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
|
return {
|
title: "花满芫",
|
path: url,
|
}
|
},
|
onShareTimeline() {
|
let that = this;
|
var name = that.currentInfo.customerDTO && that.currentInfo.customerDTO.name || that.currentInfo.supplierDTO &&
|
that.currentInfo.supplierDTO.name || that.currentInfo.partnerDTO && that.currentInfo.partnerDTO.name || ''
|
var url =
|
`/pages/home/home?shareId=${this.currentInfo&&this.currentInfo.id||''}&shareName=${name||''}`; //你的转发页面路径拼接参数
|
return {
|
title: "花满芫",
|
path: url,
|
}
|
},
|
// #endif
|
onShow() {
|
this.cacheUserId = ''
|
this.getTj()
|
this.getOrderConfig()
|
|
},
|
onLoad(options) {
|
// const url = options.q ? decodeURIComponent(options.q) : '';
|
// const urlcode = options.url && decodeURIComponent(options.url) || ''
|
// #ifdef PUB_CUSTOMER
|
if (options.partnerUserId) {
|
this.bindPartnerUser(options.partnerUserId, options.partnerUserName)
|
}
|
// #endif
|
|
|
},
|
created() {
|
|
},
|
|
async onPullDownRefresh() {
|
await this.$store.dispatch('getCurrentInfo')
|
uni.stopPullDownRefresh()
|
},
|
methods: {
|
|
async getOrderConfig() {
|
this.$message.showLoading()
|
const {
|
code,
|
data
|
} = await this.$http.request('get', `/v2/config-param/base/getBaseString`, {
|
params: {
|
paramGroup: "order",
|
paramKey: "order_cancel_time"
|
|
}
|
})
|
this.$message.hideLoading()
|
|
if (code === 0) {
|
console.log(data)
|
this.orderCancelTime =data
|
}
|
},
|
async bindPartnerUser(userId, name) {
|
// await this.$message.confirm(`确定要绑定${name}合伙人吗?`)
|
//调用接口绑定
|
this.$message.showLoading()
|
const {
|
code,
|
data
|
} = await this.$http.request('post', '/api/customer/bind/partner', {
|
data: {
|
partnerUserId: userId
|
}
|
})
|
this.$message.hideLoading()
|
if (code == 0) {
|
this.$message.showToast(`绑定合伙人${name}成功`)
|
await this.$store.dispatch('getCurrentInfo')
|
}
|
},
|
async scanPartnerCode() {
|
//扫二维码确认
|
let that = this
|
uni.scanCode({
|
success: async function(res) {
|
console.log('条码内容:' + res.result);
|
if (!res.result) {
|
that.$message.showToast('未识别出合伙人信息,请用微信扫码打开')
|
return
|
}
|
var dto = undefined
|
try {
|
if (res.result && (res.result.startsWith('https://') || res.result.startsWith(
|
'http://')) && res.result.indexOf(
|
'partnerUserId') >= 0) {
|
var arr = res.result.split("?")[1].split("&")
|
dto = {}
|
for (var item of arr) {
|
var tarr = item.split("=")
|
// console.log('tarr',tarr)
|
if (tarr[1]) {
|
dto[tarr[0]] = tarr[1]
|
}
|
}
|
dto['name'] = dto['partnerUserName'] || ''
|
dto['userId'] = dto['partnerUserId'] || ''
|
// console.log('tmp arr',arr,dto)
|
|
} else {
|
dto = JSON.parse(res.result)
|
|
}
|
if (!!dto['userId']) {
|
var partnerName = dto['name'] || ''
|
var partnerId = dto['userId'] || ''
|
that.bindPartnerUser(partnerId, partnerName)
|
|
} else {
|
that.$message.showToast('二维码格式不正确扫码失败')
|
}
|
} catch (e) {
|
console.log('e', e)
|
that.$message.showToast('二维码扫码错误')
|
}
|
},
|
fail() {
|
that.$message.showToast('扫码失败')
|
|
}
|
});
|
},
|
|
|
toInfo() {
|
var url = ''
|
if (this.currentInfo.id) {
|
// #ifdef PUB_CUSTOMER
|
url = '/sub_pages/customer/customer-info/customer-info'
|
// #endif
|
// #ifdef PUB_PARTNER
|
url = '/sub_pages/partner/partner-info/partner-info'
|
// #endif
|
// #ifdef PUB_SUPPLIER
|
url = '/sub_pages/supplier/supplier-info/supplier-info'
|
// #endif
|
if (url) {
|
uni.navigateTo({
|
url: url
|
})
|
}
|
}
|
},
|
getTj() {
|
// /api/supplier/delivery
|
|
if (this.currentInfo.id && this.currentInfo.id !== this.cacheUserId) {
|
this.cacheUserId = this.currentInfo.id
|
let that = this
|
setTimeout(() => {
|
|
|
|
// #ifdef PUB_CUSTOMER
|
this.$http.request('get', '/api/customer/center/tj', {}).then(res => {
|
if (res.code === 0) {
|
that.tj = res.data || {}
|
}
|
})
|
//获取待支付数目
|
|
this.$http.request('get', '/api/customer/order/statistics/count', {
|
params: {}
|
}).then(res => {
|
if (res.code === 0) {
|
// that.order_pendding_num = res.data || 0
|
that.tj_order = res.data || {}
|
// this.$forceUpdate()
|
console.log('tj_order', that.tj_order)
|
}
|
})
|
//判断有没有签到
|
let that = this
|
this.$http.request('get', '/api/customer/point/sign/sign/today', {}).then(res => {
|
if (res.data) {
|
that.signToday = true
|
}
|
})
|
|
// #endif
|
}, 200)
|
}
|
|
},
|
|
async clearlogout() {
|
await this.$message.confirm('是否退出登录?')
|
this.$store.commit('updateLogin', false)
|
|
uni.reLaunch({
|
url: '/pages/login/supplier-login'
|
})
|
},
|
async callTel() {
|
await this.$message.confirm('是否拨打客服电话')
|
uni.makePhoneCall({
|
phoneNumber: this.tel //仅为示例
|
});
|
},
|
toCustomerLogin() {
|
uni.navigateTo({
|
url: '/pages/login/supplier-login'
|
})
|
},
|
}
|
}
|
</script>
|
|
<style lang="scss" scoped>
|
@import "@/pages/user/user.scss";
|
</style>
|
<!-- #ifdef PUB_CUSTOMER -->
|
<style lang="scss" scoped>
|
@import "@/pages/user/user-customer.scss";
|
</style>
|