Browse Source

商城和订单流

devlop
mo-bai 4 years ago
parent
commit
53e5d31c96
35 changed files with 1830 additions and 464 deletions
  1. 45
      apis/addressManageApi.js
  2. 51
      enums/index.js
  3. 32
      pages.json
  4. 270
      pages/add-address-manage/index.vue
  5. 272
      pages/address-manage/index.vue
  6. 3
      pages/cart/index.vue
  7. 7
      pages/cart/no-data.vue
  8. 2
      pages/mall/index.vue
  9. 597
      pages/mine/index.vue
  10. 572
      pages/order-detail/index.vue
  11. 271
      pages/order-list/index.vue
  12. 130
      pages/order-make/index.vue
  13. BIN
      static/imgs/.DS_Store
  14. BIN
      static/imgs/digital-workshops/个人中心.sketch
  15. BIN
      static/imgs/mine/.DS_Store
  16. BIN
      static/imgs/mine/address-icon.png
  17. BIN
      static/imgs/mine/certification-icon.png
  18. BIN
      static/imgs/mine/certified-icon.png
  19. BIN
      static/imgs/mine/client-default.png
  20. BIN
      static/imgs/mine/contract-icon.png
  21. BIN
      static/imgs/mine/default-avatar.png
  22. BIN
      static/imgs/mine/enquiry-icon.png
  23. BIN
      static/imgs/mine/enterprise-icon.png
  24. BIN
      static/imgs/mine/logout-icon.png
  25. BIN
      static/imgs/mine/mine-top-bg.png
  26. BIN
      static/imgs/mine/non-certified-icon.png
  27. BIN
      static/imgs/mine/order-all-icon.png
  28. BIN
      static/imgs/mine/order-done-icon.png
  29. BIN
      static/imgs/mine/order-icon.png
  30. BIN
      static/imgs/mine/order-ing-icon.png
  31. BIN
      static/imgs/mine/order-ready-icon.png
  32. BIN
      static/imgs/mine/order-supplier-ready-icon.png
  33. BIN
      static/imgs/mine/user-avatar.png
  34. 15
      store/index.js
  35. 27
      utils/hook.js

45
apis/addressManageApi.js

@ -0,0 +1,45 @@
import http from '../utils/http/index.js'
/**
* 查询收货地址
* swagger: http://api-ops-uec-test.qniao.cn/uec/swagger-ui/index.html?urls.primaryName=CustomerApi#/%E4%BC%81%E4%B8%9A%E6%9F%A5%E8%AF%A2%E6%8E%A5%E5%8F%A3/getEnterpriseShippingAddressListByEnterpriseIdUsingGET
*/
export const getAddress = (data = {}) => {
return http.get({
url: '/uec/get/enterprise-shipping-address-list/by-enterpriseId',
data
})
}
/**
* 保存收货地址
* swagger: http://api-ops-uec-test.qniao.cn/uec/swagger-ui/index.html?urls.primaryName=CustomerApi#/%E4%BC%81%E4%B8%9A/saveEnterpriseShippingAddressByEnterpriseIdUsingPOST
*/
export const createAddress = (data = {}) => {
return http.post({
url: '/uec/save/enterprise-shipping-address/by/enterprise-id',
data
})
}
// 删除收货地址
export const delAddress = (data = {}) => {
return http.post({
url: '/uec/delete/enterprise-shipping-address',
data
})
}
// 设置默认地址
export const setDefaultAddress = (data = {}) => {
return http.post({
url: '/uec/set/enterprise-shipping-address/as/default',
data
})
}
// 通过id查询企业收货地址 /uec/get/enterprise-shipping-address-detail
export const getAddressDetail = (data = {}) => {
return http.get({
url: '/uec/get/enterprise-shipping-address-detail',
data
})
}

51
enums/index.js

@ -168,6 +168,57 @@ export const fsAuditStatus = {
REJECT: 3
}
/**
* 客户订单状态 0: 全部 ; 30100: 待确认 ; 30204: 待供应商确认 ; 30101: 已下单 ; 30104: 已完成 ; 30105: 已取消
*/
export const orderStatusEnum = {
ALL: 0,
WAIT_CONFIRM: 30100,
WAIT_SUPPLIER_CONFIRM: 30204,
ORDERED: 30101,
FINISHED: 30104,
CANCELED: 30105
}
/**
* 客户订单状态 0: 全部 ; 30100: 待确认 ; 30204: 待供应商确认 ; 30101: 已下单 ; 30104: 已完成 ;
*/
export const orderStatusArray = [
{
value: orderStatusEnum.ALL,
label: '全部'
},
{
value: orderStatusEnum.WAIT_CONFIRM,
label: '待确认'
},
{
value: orderStatusEnum.WAIT_SUPPLIER_CONFIRM,
label: '待供应商确认'
},
{
value: orderStatusEnum.ORDERED,
label: '已下单'
},
{
value: orderStatusEnum.FINISHED,
label: '已完成'
},
{
value: orderStatusEnum.CANCELED,
label: '已取消'
}
]
export const orderStatusMap = {
[orderStatusEnum.ALL]: '全部',
[orderStatusEnum.WAIT_CONFIRM]: '待确认',
[orderStatusEnum.WAIT_SUPPLIER_CONFIRM]: '待供应商确认',
[orderStatusEnum.ORDERED]: '已下单',
[orderStatusEnum.FINISHED]: '已完成',
[orderStatusEnum.CANCELED]: '已取消'
}
/**
* 供应商订单状态 待客户确认订单/30202,待供应商确认订单/30205,待发货/30106,已发货/30107 ,待客户借款/30207,支付中/30208,待客户支付/30214,付款失败/30211,已完成/30213,待客户还款/30217,已取消/30212,还款中/30216
*/

32
pages.json

@ -107,6 +107,22 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/address-manage/index",
"style": {
"navigationBarTitleText": "地址管理",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/add-address-manage/index",
"style": {
"navigationBarTitleText": "地址管理",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/paper-details/index",
"style": {
@ -123,6 +139,22 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/order-list/index",
"style": {
"navigationBarTitleText": "订单列表",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/order-detail/index",
"style": {
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/mine/index",
"style": {

270
pages/add-address-manage/index.vue

@ -0,0 +1,270 @@
<template>
<view class="wrapper">
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed :title="titleText"></uni-nav-bar>
</view>
<view class="qn-form-item">
<view class="label"><text class="label__text">收货人</text></view>
<view class="value">
<qn-easyinput
:maxlength="20"
@blur="showCompany"
v-model="form.receiver"
:inputBorder="false"
text="left"
placeholder="请填写收货人姓名"
></qn-easyinput>
</view>
</view>
<view class="qn-form-item">
<view class="label"><text class="label__text">手机号</text></view>
<view class="value">
<qn-easyinput
:maxlength="11"
type="number"
v-model="form.receiverMobile"
:inputBorder="false"
text="left"
placeholder="请填写收货人手机号"
></qn-easyinput>
</view>
</view>
<view class="qn-form-item">
<view class="label"><text class="label__text">所在地区</text></view>
<view class="value">
<qn-data-picker
:readonly="hasSelected"
text="left"
:border="false"
class="qn-picker"
placeholder="点击选择"
popup-title="请选择城市"
:map="{ text: 'name', value: 'id' }"
@change="onAreaChange"
:clear-icon="true"
:localdata="items"
>
<text v-if="form.districtId">{{ `${form.provinceName || ''}/${form.cityName || ''}/${form.districtName || ''}/${form.streetName || ''}` }}</text>
</qn-data-picker>
</view>
</view>
<view class="qn-form-item">
<view class="label"><text class="label__text">详细地址</text></view>
<view class="value">
<qn-easyinput
:maxlength="120"
@blur="showCompany"
v-model="form.detail"
:inputBorder="false"
text="left"
placeholder="街道/门牌号/小区/乡镇/村等"
></qn-easyinput>
</view>
</view>
<view class="default-address">
<view>
<view class="title">设置为默认地址</view>
<view class="tip">提醒每次下单会默认使用该地址</view>
</view>
<view><switch :checked="form.isDefault == 1" @change="switchChange" style="transform: scale(0.8)" /></view>
</view>
<qn-footer fixed height="120rpx">
<view class="button-area">
<view class="button button__submit" @click="addTap"><text class="text" style="color: white">保存</text></view>
</view>
</qn-footer>
</view>
</template>
<script>
import { getArea } from '@/apis/commonApi.js'
import { back } from '@/utils/hook.js'
import { createAddress, getAddressDetail } from '@/apis/addressManageApi.js'
export default {
data() {
return {
form: {
cityId: '',
cityName: '',
detail: '',
districtId: '',
districtName: '',
enterpriseId: this.$store.state.companyInfo.id,
id: '',
isDefault: '0',
provinceId: '',
provinceName: '',
receiver: '',
receiverMobile: '',
streetId: '',
streetName: ''
},
hasSelected: false,
items: [],
id: null
}
},
mounted() {
getArea().then((res) => {
if (res) {
this.items = res
}
})
},
onLoad(option) {
this.titleText = option.type
if (option.id) {
this.id = option.id
this.getAddressDetail()
}
},
methods: {
back,
// id
getAddressDetail() {
getAddressDetail({ id: this.id }).then((res) => {
// console.log('', res)
if (res) {
this.form = Object.assign({}, res)
}
})
},
onAreaChange(e) {
if (e.detail.value && e.detail.value.length > 0) {
const [province, city, district, street] = e.detail.value
this.form.provinceId = province.value
this.form.provinceName = province.text
this.form.cityId = city.value
this.form.cityName = city.text
this.form.districtId = district.value
this.form.districtName = district.text
this.form.streetId = street.value
this.form.streetName = street.text
} else {
this.form.provinceId = null
this.form.provinceName = null
this.form.cityId = null
this.form.cityName = null
this.form.districtId = null
this.form.districtName = null
this.form.streetId = null
this.form.streetName = null
}
},
//
switchChange(e) {
this.form.isDefault = e.target.value ? '1' : '0'
},
//
addTap() {
createAddress(this.form).then((res) => {
if (res) {
uni.showToast({
title: '保存成功',
icon: 'success'
})
setTimeout(() => {
back()
}, 1000)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
.wrapper-title {
width: 100%;
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
.qn-form-item {
width: 750rpx;
padding: 0rpx 32rpx;
background-color: #fff;
display: flex;
flex-direction: row;
align-items: center;
// justify-content: space-between;
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
min-height: 88rpx;
.label {
flex-grow: 0;
flex-shrink: 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
margin-right: 20rpx;
.label__text {
font-size: 28rpx;
color: #000000;
}
}
.value {
flex-grow: 1;
flex-shrink: 1;
text-align: right;
}
}
.default-address {
margin-top: 20rpx;
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0rpx 32rpx;
height: 133rpx;
background: #ffffff;
.title {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
}
.tip {
padding-top: 10rpx;
font-size: 24rpx;
color: #888888;
letter-spacing: 0;
font-weight: 400;
}
}
.button-area {
width: 750rpx;
padding: 0 32rpx;
display: flex;
flex-direction: row;
align-items: center;
// justify-content: space-between;
.button {
flex-grow: 0;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
.text {
font-size: 30rpx;
font-weight: 500;
text-align: center;
}
}
.button__cancel {
width: 270rpx;
height: 88rpx;
border: 2rpx solid #979797;
}
.button__submit {
width: 100%;
height: 88rpx;
background: #007aff;
}
}
}
</style>

272
pages/address-manage/index.vue

@ -0,0 +1,272 @@
<template>
<view class="wrapper">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="收货地址"></uni-nav-bar>
<view class="content" v-for="(item, index) in list" :key="index">
<view class="info-box" @tap="selectAddress(item)">
<view class="name">{{ item.receiver }} {{ item.receiverMobile }}</view>
<view class="address">{{ item.provinceName }}{{ item.cityName }}{{ item.districtName }}{{ item.streetName }}{{ item.detail }}</view>
</view>
<view class="other">
<view class="left">
<label @tap="radioTap(item)">
<radio :checked="item.isDefault == 1" style="transform: scale(0.8)" />
<text :class="item.isDefault == 1 ? 'radioText' : 'not-radioText'">{{ item.isDefault == 1 ? '已设为默认' : '设为默认' }}</text>
</label>
</view>
<view class="right">
<view @tap="delTap(item, index)">删除</view>
<view class="edit" @tap="editTap(item, index)">编辑</view>
</view>
</view>
</view>
<qn-footer fixed height="120rpx">
<view class="button-area">
<view class="button button__submit" @click="addTap"><text class="text" style="color: white">添加地址</text></view>
</view>
</qn-footer>
<uni-popup ref="popup" type="center" :mask-click="false">
<view class="popup-box">
<view class="tip-title">确定要删除改地址吗</view>
<view class="operation-row">
<view class="cancel-text" @tap="cancelTap">取消</view>
<view class="line"></view>
<view class="confirm-text" @tap="confirmTap">确定</view>
</view>
</view>
</uni-popup>
</view>
</template>
<script>
import { go2, back, setCache } from '@/utils/hook.js'
import { getAddress, delAddress, setDefaultAddress } from '@/apis/addressManageApi.js'
export default {
data() {
return {
/**
* 页面操作类型 none: 无操作, select: 选择
*/
operation: 'none',
list: [],
id: null
}
},
onShow() {
this.queryData()
},
methods: {
go2,
back,
//
queryData() {
const params = {
enterpriseId: this.$store.state.companyInfo.id
}
getAddress(params).then((res) => {
if (res) {
this.list = res
}
})
},
//
radioTap(item) {
setDefaultAddress({ id: item.id }).then((res) => {
if (res) {
this.queryData()
}
})
},
//
selectAddress(item) {
if (this.operation === 'select') {
setCache('address', item)
back()
}
},
//
addTap() {
go2('add-address-manage', { type: '新增地址' })
},
//
delTap(item, index) {
this.id = item.id
this.$refs.popup.open('center')
// this.$refs.popup.close()
},
//
editTap(item, index) {
go2('add-address-manage', { id: item.id, type: '编辑地址' })
},
confirmTap() {
delAddress({ id: this.id }).then((res) => {
this.$refs.popup.close()
if (res) {
uni.showToast({
title: '删除成功',
icon: 'success'
})
this.queryData()
}
})
},
cancelTap() {
this.$refs.popup.close()
}
},
onLoad(option) {
if (option) {
this.operation = option.operation
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
.content {
padding-bottom: 16rpx;
.info-box {
max-height: 197rpx;
background: #ffffff;
padding: 27rpx 32rpx;
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
.name {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
}
.address {
padding-top: 16rpx;
font-size: 28rpx;
color: #333333;
letter-spacing: 0;
font-weight: 400;
}
}
.other {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0rpx 32rpx;
height: 80rpx;
background: #ffffff;
.radioText {
font-size: 28rpx;
color: #007aff;
letter-spacing: 0;
font-weight: 400;
}
.not-radioText {
font-size: 28rpx;
color: #888888;
letter-spacing: 0;
font-weight: 400;
}
.left {
font-size: 28rpx;
color: #007aff;
letter-spacing: 0;
font-weight: 400;
}
.right {
display: flex;
flex-direction: row;
justify-content: space-between;
font-size: 28rpx;
color: #888888;
letter-spacing: 0;
font-weight: 400;
.edit {
padding-left: 32rpx;
}
}
}
}
.button-area {
width: 750rpx;
padding: 0 32rpx;
display: flex;
flex-direction: row;
align-items: center;
.button {
flex-grow: 0;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: center;
border-radius: 10rpx;
.text {
font-size: 30rpx;
font-weight: 500;
text-align: center;
}
}
.button__cancel {
width: 270rpx;
height: 88rpx;
border: 2rpx solid #979797;
}
.button__submit {
width: 100%;
height: 88rpx;
background: #007aff;
}
}
.popup-box {
width: 540rpx;
height: 226rpx;
background: #ffffff;
border-radius: 14rpx;
.tip-title {
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
height: 126rpx;
font-size: 32rpx;
color: #333333;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
.operation-row {
display: flex;
flex-direction: row;
justify-content: space-around;
align-items: center;
height: 100rpx;
background: #ffffff;
border-top: 2rpx solid rgba(221, 221, 221, 0.5);
.cancel-text {
flex-grow: 1;
flex-shrink: 1;
font-size: 36rpx;
color: #000000;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
.line {
flex-grow: 0;
flex-shrink: 0;
width: 2rpx;
height: 100rpx;
border-left: 2rpx solid #dcdee3;
}
.confirm-text {
flex-grow: 1;
flex-shrink: 1;
font-size: 36rpx;
color: #108ee9;
letter-spacing: 0;
text-align: center;
font-weight: 400;
}
}
}
}
</style>

3
pages/cart/index.vue

@ -83,14 +83,11 @@
</template>
<script>
import qnFooter from '@/components/qn-footer/qn-footer.vue'
import { go2, back } from '@/utils/hook.js'
import qnInputNumber from '@/components/qn-input-number/qn-input-number.vue'
import { getShoppingCarList, removeShoppingCar, closePaperReserve } from '@/apis/mallApi.js'
import noData from './no-data.vue'
import { round } from '@/utils/index.js'
export default {
components: { qnInputNumber, qnFooter, noData },
data() {
return {
option: {

7
pages/cart/no-data.vue

@ -3,7 +3,7 @@
<image class="icon" src="/static/imgs/cart/no-data-icon.png"></image>
<view class="text-row">
<view>购物车是空的快去</view>
<view class="btn" @tap="nativeTo">逛逛</view>
<view class="btn" @tap="go2('mall')">逛逛</view>
</view>
</view>
</template>
@ -21,10 +21,7 @@ export default {
return {}
},
methods: {
//
nativeTo() {
go2('store')
}
go2
}
}
</script>

2
pages/mall/index.vue

@ -45,7 +45,7 @@
</view>
</view>
</scroll-list>
<image src="/static/imgs/mall/cart-icon.png" class="image_11" />
<image @click="go2('cart')" src="/static/imgs/mall/cart-icon.png" class="image_11" />
</view>
</template>

597
pages/mine/index.vue

@ -1,102 +1,62 @@
<template>
<view class="content">
<view class="top-area">
<view class="reset">
<image class="bg" src="/static/imgs/mine/mine-top-bg.png"></image>
<view class="operation-area">
<view class="user">
<image class="avatar" :src="curAvatar"></image>
<view v-if="!hasLogin" @click="go2('login')">
<view>
<text style="font-size: 40rpx; color: #fff; font-weight: 600">点击登录</text>
</view>
<view style="margin-top: 10rpx">
<text style="font-size: 26rpx; color: #fff; font-weight: 400">登录解锁更全功能</text>
</view>
<image class="bg" src="/static/imgs/mine/mine-top-bg.png"></image>
<view class="operation-area">
<view class="user">
<image class="avatar" :src="curAvatar"></image>
<view v-if="!hasLogin" @click="go2('login')">
<view>
<text style="font-size: 40rpx; color: #fff; font-weight: 600">点击登录</text>
</view>
<view v-else>
<view class="user__name">
<text class="name">{{ userInfo.name }}</text>
<image v-if="userInfo.fddEnterpriseStatus === fddStatus.CERTIFIED_SUCCESS" class="image" src="/static/imgs/mine/certified-icon.png"></image>
<image v-else class="image" @click="certifyCompany()" src="/static/imgs/mine/non-certified-icon.png"></image>
</view>
<view style="margin-top: 30rpx">
<text
style="font-size: 26rpx; color: #fff; font-weight: 400; word-break: break-all"
@click="loginGo2(hasCompany ? 'enterprise-info-edit' : 'enterprise-info')"
>
{{ hasCompany ? userInfo.supplierName : '点击完善企业信息' }}
</text>
</view>
<view style="margin-top: 10rpx">
<text style="font-size: 26rpx; color: #fff; font-weight: 400">登录解锁更全功能</text>
</view>
</view>
<view class="operation">
<view class="box" v-if="hasLogin">
<view class="container" v-if="hasCompany" @click="go2('message')">
<image class="icon" src="/static/imgs/mine/msg-icon.png"></image>
<view v-if="messageNum > 0" class="number">
<text class="text">{{ messageNum }}</text>
</view>
</view>
<image class="icon" @click="go2('setting')" src="/static/imgs/mine/setting-icon.png"></image>
<view v-else>
<view class="user__name">
<text class="name">{{ userInfo.name }}</text>
<image v-if="userInfo.fddEnterpriseStatus === fddStatus.CERTIFIED_SUCCESS" class="image" src="/static/imgs/mine/certified-icon.png"></image>
<image v-else class="image" @click="certifyCompany()" src="/static/imgs/mine/non-certified-icon.png"></image>
</view>
<view v-if="companyNum > 1" class="box" @click="go2('toggle-supplier')">
<text style="font-size: 24rpx; color: #fff; flex-shrink: 0">切换账号</text>
<image class="icon" style="width: 24rpx; height: 24rpx; margin-left: 8rpx" src="/static/imgs/mine/toggle-icon.png"></image>
<view style="margin-top: 16rpx">
<text
style="font-size: 26rpx; color: #fff; font-weight: 400; word-break: break-all"
@click="loginGo2(hasCompany ? 'enterprise-info-edit' : 'enterprise-info')"
>
{{ hasCompany ? userInfo.companyName : '点击完善企业信息' }}
</text>
</view>
</view>
</view>
<view class="vip-area">
<view class="vip-content">
<view class="left">
<image class="icon" src="/static/imgs/mine/vip-icon.png"></image>
<text class="text">VIP会员</text>
</view>
<text class="center">{{ isVip ? `到期时间:${vipExpireTime}` : '立即开通会员 尊享特权' }}</text>
<view class="right" @click="makeVip">
<text class="text">{{ isVip ? '续费会员' : '开通会员' }}</text>
</view>
</view>
<view v-if="hasLogin" class="logout" @click="logout">
<text class="text">退出登录</text>
<image class="icon" src="/static/imgs/mine/logout-icon.png"></image>
</view>
</view>
</view>
<view class="card-area">
<view class="header">
<view class="item" style="justify-content: flex-start">
<image class="icon" style="width: 32rpx; height: 32rpx" src="/static/imgs/mine/money-icon.png"></image>
<text class="text">掌柜收入</text>
</view>
<view class="item" style="justify-content: flex-end">
<qn-data-picker
v-model="tradeDate"
text="right"
:border="false"
placeholder="交易区间"
popup-title="请选择时间"
:localdata="tradeRange"
:clear-icon="false"
v-slot:default="{ data }"
>
<view class="time-range">
<text style="font-size: 24rpx; color: rgba(0, 0, 0, 0.65); margin-right: 8rpx">{{ data[0] ? data[0].value : '' }}</text>
<text style="font-size: 24rpx; color: #333333; font-weight: 500; margin-right: 8rpx">{{ data[0] ? data[0].text : '' }}</text>
<uni-icons type="bottom" size="14" color="rgba(0,0,0,0.65)"></uni-icons>
</view>
</qn-data-picker>
</view>
<text style="font-size: 30rpx; color: rgba(0, 0, 0, 0.85); font-weight: 600">我的设备</text>
</view>
<view class="order-area">
<view class="order-item">
<text class="value">{{ tradeData.tradingVolume }}</text>
<text class="label">交易额()</text>
</view>
<view class="order-item">
<text class="value">{{ tradeData.volumeOfBusiness }}</text>
<text class="label">交易量()</text>
</view>
<view class="order-item">
<text class="value">{{ tradeData.orderQuantity }}</text>
<text class="label">成交订单()</text>
</view>
<view class="card-area" v-if="fsInfo.status !== -1" style="border-radius: 16rpx">
<image
class="poster"
v-if="fsInfo.status == fsAuditStatus.WAIT_APPLY || fsInfo.status == fsAuditStatus.REJECT"
src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/fs-to-apply.png"
@click="applyForFinance()"
></image>
<image
class="poster"
v-if="fsInfo.status == fsAuditStatus.AUDITING"
src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/fs-applying.png"
></image>
<view class="header" v-if="fsInfo.status == fsAuditStatus.PASS">
<text style="font-size: 30rpx; color: rgba(0, 0, 0, 0.85); font-weight: 600">飞算资金</text>
<view class="item" @click="loginGo2('order-list', { status: orderStatusEnum.ALL })">
<text style="font-size: 26rpx; color: rgba(0, 0, 0, 0.65)">查看明细</text>
<uni-icons style="margin-left: 16rpx" type="right" size="10"></uni-icons>
</view>
</view>
</view>
@ -105,37 +65,25 @@
<text style="font-size: 30rpx; color: rgba(0, 0, 0, 0.85); font-weight: 600">其他工具</text>
</view>
<view class="icon-area">
<view class="icon-item" @click="loginGo2('trade')">
<view class="icon-item" @click="loginGo2('order-list', { status: orderStatusEnum.ALL })">
<image class="icon" src="/static/imgs/mine/order-icon.png"></image>
<text class="label">订单管理</text>
<text class="label">全部订单</text>
</view>
<view class="icon-item" @click="handleJump('credit-order-list')">
<image class="icon" src="/static/imgs/mine/finance-icon.png"></image>
<text class="label">账期订单融资</text>
<view class="icon-item" @click="loginGo2('enquiry-list')">
<image class="icon" src="/static/imgs/mine/enquiry-icon.png"></image>
<text class="label">询价结果</text>
</view>
<view class="icon-item" @click="handleJump('contract-manage')">
<view class="icon-item" @click="loginGo2('enquiry-list')">
<image class="icon" src="/static/imgs/mine/contract-icon.png"></image>
<text class="label">合同管理</text>
</view>
<view class="icon-item" @click="loginGo2('credit-management')">
<image class="icon" src="/static/imgs/mine/credit-icon.png"></image>
<text class="label">征信管理</text>
</view>
<view class="icon-item" @click="loginGo2('client-credit-list')">
<image class="icon" src="/static/imgs/mine/credit-record.png"></image>
<text class="label">授信记录</text>
</view>
<view class="icon-item" @click="loginGo2('my-client')">
<image class="icon" src="/static/imgs/mine/my-client.png"></image>
<text class="label">客户列表</text>
<view class="icon-item" @click="loginGo2('enquiry-list')">
<image class="icon" src="/static/imgs/mine/certification-icon.png"></image>
<text class="label">验厂申请</text>
</view>
<view class="icon-item" @click="loginGo2('my-receipt-code')">
<image class="icon" src="/static/imgs/mine/my-receipt-code.png"></image>
<text class="label">收款码</text>
</view>
<view class="icon-item" @click="exit(true)">
<image class="icon" src="/static/imgs/mine/my-receipt-code.png"></image>
<text class="label">收款码</text>
<view class="icon-item" @click="loginGo2('address-manage')">
<image class="icon" src="/static/imgs/mine/enterprise-icon.png"></image>
<text class="label">我的企业</text>
</view>
</view>
</view>
@ -143,59 +91,44 @@
</template>
<script>
import { go2, loginGo2, exit } from '@/utils/hook.js'
import { fddEnterpriseStatus } from '@/enums/index.js'
import { getBaseInfo, getVerifyUrl } from '@/apis/commonApi.js'
import qnDataPicker from '@/components/qn-data-picker/qn-data-picker.vue'
import { dateTimeFormat } from '@/utils/index.js'
import { getOrderStatistics } from '@/apis/mineApi.js'
//
const currentMonth = (() => {
let endDate = new Date()
let beginDate = new Date(endDate.getFullYear(), endDate.getMonth(), 1)
return [dateTimeFormat(beginDate, 'yyyy-mm-dd'), dateTimeFormat(endDate, 'yyyy-mm-dd')]
})()
import { exit, go2, loginGo2 } from '@/utils/hook.js'
import { fddEnterpriseStatus, fsAuditStatus, orderStatusEnum, VIP_URL, QN_APPID } from '@/enums/index.js'
import { getVerifyUrl, getFsCredit, getBaseInfo, getFeisuanUrl } from '@/apis/commonApi.js'
//
const lastMonth = (() => {
let now = new Date()
let endDate = new Date(now.getFullYear(), now.getMonth(), 0)
let beginDate = new Date(now.getFullYear(), now.getMonth() - 1, 1)
return [dateTimeFormat(beginDate, 'yyyy-mm-dd'), dateTimeFormat(endDate, 'yyyy-mm-dd')]
})()
export default {
components: { qnDataPicker },
data() {
return {
customerServicer: '17606507108',
fddStatus: Object.freeze(fddEnterpriseStatus),
messageNum: 0,
companyNum: 0,
tradeRange: [
{
text: '本月',
value: currentMonth.join('~')
},
{
text: '上月',
value: lastMonth.join('~')
},
{
text: '总计',
value: ''
}
],
tradeDate: currentMonth.join('~'),
tradeData: {
tradingVolume: 0,
volumeOfBusiness: 0,
orderQuantity: 0
}
fsInfo: {
status: -1, //
availableCreditLine: 0,
usedCreditLine: 0,
creditLine: 0
},
fsAuditStatus: Object.freeze(fsAuditStatus),
orderStatusEnum: Object.freeze(orderStatusEnum)
}
},
methods: {
exit,
makeVip() {
if (!this.hasLogin) {
go2('login')
return
}
if (this.hasCompany) {
let redirectUrl = encodeURIComponent(VIP_URL)
window.location.href = `https://open.weixin.qq.com/connect/oauth2/authorize?appid=${QN_APPID}&redirect_uri=${redirectUrl}&response_type=code&scope=snsapi_base&state=STATE#wechat_redirect`
} else {
uni.showToast({
title: '请先完善企业信息',
icon: 'none'
})
}
},
loginGo2,
logout() {
exit()
},
//
certifyCompany() {
if (!this.hasCompany) {
@ -205,104 +138,45 @@ export default {
})
return
}
if (
this.userInfo.fddEnterpriseStatus === fddEnterpriseStatus.UNCERTIFIED ||
this.userInfo.fddEnterpriseStatus === fddEnterpriseStatus.CERTIFIED_FAIL ||
this.userInfo.fddEnterpriseStatus === fddEnterpriseStatus.CERTIFIED_ING
) {
if (this.userInfo.fddEnterpriseStatus === fddEnterpriseStatus.UNCERTIFIED || this.userInfo.fddEnterpriseStatus === fddEnterpriseStatus.CERTIFIED_FAIL) {
getVerifyUrl({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => {
if (res) {
// #ifdef APP-PLUS
go2('page-view', { title: '实名认证', url: encodeURIComponent(res) })
go2('page-view', {
title: '实名认证',
url: encodeURIComponent(res)
})
// #endif
// #ifdef H5
if (window) {
window.location.href = res
}
window ? (window.location.href = res) : ''
// #endif
}
})
}
},
go2,
loginGo2,
handleJump(page) {
if (!this.hasCompany) {
uni.showToast({
title: '您还没有企业,请先加入企业',
icon: 'none'
})
return
}
loginGo2(page)
},
makeVip() {
if (this.hasCompany) {
loginGo2('vip-center')
} else {
if (this.userInfo.fddEnterpriseStatus === fddEnterpriseStatus.UNCERTIFIED) {
uni.showToast({
title: '请先完善企业信息',
title: '认证中,请稍后~',
icon: 'none'
})
}
},
//
copyPhone() {
uni.setClipboardData({
data: this.customerServicer,
success: () => {
uni.showToast({
title: '复制成功',
icon: 'none',
duration: 2000
})
}
})
},
//
getStatistics() {
if (!this.hasLogin) {
return
}
let beginDate = this.tradeDate.split('~')[0] || ''
let endDate = this.tradeDate.split('~')[1] || ''
// id
let currentSupplier = this.$store.state.companyInfo.supplierId
getOrderStatistics({
beginDate,
endDate,
currentSupplier
}).then((res) => {
console.log('res', res)
go2,
applyForFinance() {
getFeisuanUrl().then((res) => {
if (res) {
this.tradeData = res
// #ifdef APP-PLUS
go2('page-view', {
title: '飞算申请',
url: encodeURIComponent(res)
})
// #endif
// #ifdef H5
window ? (window.location.href = res) : ''
// #endif
}
})
}
},
watch: {
'$store.state.companyInfo.supplierId': {
handler(val) {
console.log('切换了供应商:', val)
if (val) {
this.getStatistics()
}
},
immediate: true
},
tradeDate() {
this.getStatistics()
},
hasLogin(val) {
if (!val) {
//
this.tradeData = {
tradingVolume: 0,
volumeOfBusiness: 0,
orderQuantity: 0
}
}
}
//
},
computed: {
vipExpireTime() {
@ -311,14 +185,11 @@ export default {
}
return ''
},
hasLogin() {
return this.$store.state.qnToken != ''
},
isVip() {
return this.$store.state.companyInfo.isVip
},
hasCompany() {
return this.$store.state.companyInfo.id != null
hasLogin() {
return this.$store.state.qnToken != ''
},
curAvatar() {
if (!this.hasLogin) {
@ -331,49 +202,47 @@ export default {
}
},
userInfo() {
console.log('userInfo:', this.$store.state.userInfo)
console.log('companyInfo:', this.$store.state.companyInfo)
return {
avatar: this.$store.state.userInfo.avatar || '',
name: this.$store.state.userInfo.name || this.$store.state.userInfo.mobile || '',
supplierName: this.$store.state.companyInfo.name || '',
companyName: this.$store.state.companyInfo.name || '',
fddEnterpriseStatus: this.$store.state.companyInfo.fddEnterpriseStatus || 1
}
},
hasCompany() {
return this.$store.state.companyInfo.id != null
}
},
onShow() {
this.hasLogin &&
getBaseInfo({}, true).then((res) => {
getFsCredit({
enterpriseId: this.$store.state.companyInfo.id
}).then((res) => {
if (res) {
this.companyNum = res.enterpriseList?.length || 1
this.fsInfo = res
}
})
this.hasLogin && this.getStatistics()
this.hasLogin && getBaseInfo({}, true)
!this.hasLogin && (this.fsInfo.status = -1)
}
}
</script>
<style lang="scss" scoped>
.content {
width: 750rpx;
overflow: hidden;
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
width: 750rpx;
}
.top-area {
width: 750rpx;
height: 380rpx;
height: 308rpx;
overflow: hidden;
position: relative;
border-radius: 0 0 350px 350px;
transform: scaleX(2.5);
.reset {
width: 750rpx;
height: 380rpx;
transform: scaleX(0.4); //
position: relative;
overflow: hidden;
}
.bg {
width: 750rpx;
height: 380rpx;
@ -389,7 +258,7 @@ export default {
padding: 0 32rpx;
display: flex;
flex-direction: row;
align-items: flex-start;
align-items: center;
justify-content: space-between;
.user {
z-index: 5;
@ -414,7 +283,7 @@ export default {
align-items: center;
justify-content: flex-start;
.name {
font-size: 40rpx;
font-size: 38rpx;
color: #fff;
font-weight: 600;
margin-right: 16rpx;
@ -428,106 +297,24 @@ export default {
}
}
}
.operation {
.logout {
z-index: 5;
margin-top: 18rpx;
margin-left: 20rpx;
flex-grow: 0;
flex-shrink: 0;
.box {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
margin-bottom: 36rpx;
.container {
width: 40rpx;
height: 40rpx;
flex-grow: 0;
flex-shrink: 0;
margin-right: 26rpx;
position: relative;
.number {
position: absolute;
top: -12rpx;
right: -12rpx;
// width:32rpx;
// height: 32rpx;
padding: 6rpx 10rpx;
background-color: #f5222d;
border-radius: 16rpx;
display: flex;
align-items: center;
justify-content: center;
.text {
font-size: 20rpx;
color: #fff;
font-weight: 500;
}
}
}
.icon {
width: 40rpx;
height: 40rpx;
flex-grow: 0;
flex-shrink: 0;
}
}
}
}
.vip-area {
z-index: 5;
position: absolute;
bottom: 0;
left: 0;
width: 686rpx;
height: 90rpx;
margin: 0 32rpx;
background-image: linear-gradient(90deg, #333333 0%, #696c6b 99%);
border-radius: 10rpx;
.vip-content {
width: 686rpx;
padding: 18rpx 24rpx 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
.icon {
width: 28rpx;
height: 28rpx;
flex-grow: 0;
flex-shrink: 0;
}
.text {
font-size: 26rpx;
color: #dbc189;
font-weight: 500;
}
}
.center {
justify-content: flex-end;
flex-grow: 0;
flex-shrink: 0;
.text {
font-size: 24rpx;
color: #e7e1be;
font-weight: 600;
color: #ffffff;
}
.right {
position: relative;
display: flex;
flex-direction: row;
align-items: center;
justify-content: center;
width: 128rpx;
height: 44rpx;
border-radius: 14rpx;
background-image: linear-gradient(90deg, #f4edce 1%, #f3d99e 98%);
.text {
font-size: 24rpx;
color: #443015;
}
.icon {
margin-left: 8rpx;
width: 24rpx;
height: 24rpx;
flex-grow: 0;
flex-shrink: 0;
}
}
}
@ -563,83 +350,77 @@ export default {
}
}
}
.order-area {
padding: 20rpx 20rpx 30rpx;
padding: 40rpx 32rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: space-between;
.order-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
.value {
font-size: 36rpx;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
}
.label {
font-size: 26rpx;
color: #666666;
margin-top: 10rpx;
}
}
flex-wrap: nowrap;
}
.icon-area {
padding: 40rpx 32rpx;
padding: 40rpx 0;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
flex-wrap: wrap;
.icon-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
min-width: 154rpx;
margin-bottom: 36rpx;
.icon {
width: 68rpx;
height: 68rpx;
flex-grow: 0;
flex-shrink: 0;
}
.label {
font-size: 26rpx;
color: #666666;
margin-top: 10rpx;
}
}
.icon-item {
display: flex;
flex-direction: column;
align-items: center;
justify-content: center;
margin: 0 32rpx 36rpx;
.icon {
width: 68rpx;
height: 68rpx;
flex-grow: 0;
flex-shrink: 0;
}
.label {
font-size: 26rpx;
color: #666666;
margin-top: 10rpx;
}
}
.poster {
width: 686rpx;
height: 140rpx;
}
.time-range {
.fs-card {
width: 686rpx;
padding: 24rpx 32rpx 32rpx;
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
}
.vip-top {
width: 560rpx;
height: 268rpx;
background-color: #ff883b;
padding: 54rpx 20rpx;
.text {
font-size: 40rpx;
color: #ffffff;
line-height: 72rpx;
justify-content: space-between;
flex-wrap: nowrap;
.left {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
.pre {
font-size: 36rpx;
color: rgba(0, 0, 0, 0.85);
font-weight: 500;
}
.next {
font-size: 56rpx;
color: rgba(0, 0, 0, 0.85);
font-weight: 700;
}
}
}
.button {
width: 250rpx;
height: 70rpx;
background: #ff5550;
border-radius: 34rpx;
margin: 40rpx 0;
.text {
font-size: 34rpx;
color: #ffffff;
.right {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-end;
font-size: 32rpx;
color: #333333;
font-weight: 500;
}
}
</style>

572
pages/order-detail/index.vue

@ -0,0 +1,572 @@
<template>
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="订单详情"></uni-nav-bar>
<view class="status-area flex-row-center-start">
<image class="flex-base" style="width: 40rpx; height: 40rpx; margin-right: 16rpx" src="/static/imgs/order/status-icon.png"></image>
<text style="font-size: 30rpx; color: #ffffff">{{ statusImg[orderInfo.status] }}</text>
</view>
<view class="address-area">
<view class="flex-row-start-start" style="padding: 24rpx 0 40rpx">
<image class="flex-base" style="width: 100rpx; height: 100rpx; margin-right: 20rpx" src="/static/imgs/order/customer-default.png"></image>
<view class="flex-col-start-start">
<text style="font-size: 30rpx; color: #333333; font-weight: 600">{{ orderInfo.customerEnterpriseName }}</text>
<text style="font-size: 26rpx; color: #333333; margin-top: 26rpx">
联系人: {{ `${orderInfo.deliveryAddress.receiver || '-'} ${orderInfo.deliveryAddress.receiverMobile || '-'}` }}
</text>
</view>
</view>
<view class="flex-row-start-start footer">
<image style="width: 32rpx; height: 32rpx; margin-right: 10rpx" src="/static/imgs/order/location-icon.png"></image>
<text style="font-size: 26rpx; color: #333333; word-break: break-all">{{ transformAddress(orderInfo.deliveryAddress) }}</text>
</view>
</view>
<view class="order-area" v-for="(supplierOrder, index) in orderInfo.supplierOrder" :key="supplierOrder.supplierOrderId">
<view class="flex-row-center-space header">
<text style="font-size: 32rpx; font-weight: 600">{{ supplierOrder.supplierEnterpriseName }}</text>
<view>
<!-- 微信支付待付款 -->
<view v-if="supplierOrder.status == supplierOrderStatusEnum.WAIT_CLIENT_PAY" class="button-item" @click="confirmWxPay(supplierOrder.mallSupplierId)">
去付款
</view>
<!-- 待收货展示 -->
<view v-else-if="supplierOrder.status == supplierOrderStatusEnum.WAIT_RECEIVE" class="button-item" @click="confirmReceive(supplierOrder)">
确认收货
</view>
<!-- 待借款展示 -->
<view v-else-if="supplierOrder.status == supplierOrderStatusEnum.WAIT_CLIENT_LOAN" class="button-item" @click="goFsPage()">去借款</view>
<!-- 飞算支付且待还款状态 -->
<view
v-else-if="orderInfo.paymentMethod == paymentMethodEnum.FLY_PAY && supplierOrder.status == supplierOrderStatusEnum.WAIT_CLIENT_REPAY"
class="button-item"
@click="goFsPage()"
>
去还款
</view>
<text v-else style="font-size: 30rpx; color: #ff5368; font-weight: 600">{{ supplierOrderStatusMap[supplierOrder.status] }}</text>
</view>
</view>
<view v-for="order in supplierOrder.orderItems" :key="order.productId">
<view style="background-color: #fff; padding-bottom: 20rpx">
<view class="order-header flex-row-start-space">
<text style="font-size: 30rpx; font-weight: 600">
{{ `${order.brandName}${order.productName} | ${order.gramWeight}g | ${order.width}*${order.length} | ${order.pieceQuantity}` }}
</text>
</view>
<view class="order-row flex-row-center-space">
<text>重量():</text>
<text>{{ order.buyTon }}</text>
</view>
<view class="order-row flex-row-center-space">
<text>单价(/):</text>
<text>{{ order.unitPrice }}</text>
</view>
<view class="order-row flex-row-center-space">
<text>小计():</text>
<text>{{ order.subtotal }}</text>
</view>
<view class="order-row flex-row-center-space" style="margin: 0">
<text>备注信息:{{ order.remark }}</text>
</view>
</view>
<view style="padding: 24rpx 10rpx">
<uni-steps
:options="transformStep(order.outboundProcessList, order.pieceQuantity)"
active-color="#1890FF"
:active="order.outboundProcessList.length > 0 ? order.outboundProcessList.length - 1 : -1"
></uni-steps>
</view>
</view>
<!-- 送货凭证 -->
<view v-if="showSendImgs(supplierOrder.status)" class="footer" :style="showList.includes(`${index}_send`) ? '' : 'height:88rpx;'">
<view class="header flex-row-center-space">
<text style="font-size: 28rpx; font-weight: 600">送货凭证</text>
<view class="flex-row-center-end" @click="changeShowIndex(`${index}_send`)">
<text style="font-size: 28rpx; margin-right: 8rpx">{{ showList.includes(`${index}_send`) ? '收起' : '展开' }}</text>
<uni-icons :type="showList.includes(`${index}_send`) ? 'top' : 'bottom'" size="16"></uni-icons>
</view>
</view>
<view class="imgs flex-row-start-start">
<view v-for="item in supplierOrder.proofDelivery" :key="item.id" class="upload_img">
<image style="width: 120rpx; height: 120rpx" :src="item.imgUrl"></image>
</view>
</view>
</view>
<!-- 收货凭证 -->
<view v-if="showReceiveImgs(supplierOrder.status)" class="footer" :style="showList.includes(`${index}_receive`) ? '' : 'height:88rpx;'">
<view class="header flex-row-center-space">
<text style="font-size: 28rpx; font-weight: 600">收货凭证</text>
<view class="flex-row-center-end" @click="changeShowIndex(`${index}_receive`)">
<text style="font-size: 28rpx; margin-right: 8rpx">{{ showList.includes(`${index}_receive`) ? '收起' : '展开' }}</text>
<uni-icons :type="showList.includes(`${index}_receive`) ? 'top' : 'bottom'" size="16"></uni-icons>
</view>
</view>
<view class="imgs flex-row-start-start">
<view v-for="item in supplierOrder.proofReceipt" :key="item.id" class="upload_img">
<uni-icons type="clear" size="16" class="close-icon" @click="deleteVoucher(item.id)"></uni-icons>
<image style="width: 120rpx; height: 120rpx" :src="item.imgUrl"></image>
</view>
<view class="default-upload" @click="uploadVoucher(supplierOrder.supplierOrderId)">
<image src="/static/imgs/order/camera.png" class="icon"></image>
<text style="font-size: 26rpx; color: #4c4a58">上传凭证</text>
</view>
</view>
</view>
</view>
<view class="fee flex-row-center-space">
<text style="font-size: 28rpx; color: #555555">其他费用: {{ orderInfo.otherFee || 0 }}</text>
<view class="flex-row-center-end">
<text style="font-size: 28rpx; color: #555555">合计:</text>
<text style="font-size: 40rpx; color: #f5222d; font-weight: 600">{{ orderInfo.totalOfferPrice || 0 }}</text>
</view>
</view>
<view class="order-footer">
<view class="flex-row-center-space order-row">
<text class="label">订单编号</text>
<view class="flex-row-center-end value">
<text>{{ orderInfo.orderId }}</text>
<text style="color: #007aff; margin-left: 8rpx" @click="clip(orderInfo.orderId)">复制</text>
</view>
</view>
<view class="flex-row-center-space order-row">
<text class="label">下单时间</text>
<text class="value">{{ orderInfo.createTime }}</text>
</view>
<view class="flex-row-center-space order-row">
<text class="label">交货时间</text>
<text class="value">{{ orderInfo.receivedTime }}</text>
</view>
<view class="flex-row-center-space order-row" style="border: none">
<text class="label">支付方式</text>
<text class="value">{{ paymentMethodMap[orderInfo.paymentMethod] || '-' }}</text>
</view>
<view class="flex-row-center-space order-row" style="border: none">
<text class="label">是否开票</text>
<text class="value">{{ invoiceStatusMap[orderInfo.invoiceOrNot] || '-' }}</text>
</view>
</view>
<qn-footer fixed height="120rpx">
<view class="flex-row-center-end" style="padding: 0 32rpx">
<view class="button" @click="viewContract">查看合同</view>
</view>
</qn-footer>
</view>
</template>
<script>
import { go2, back, uploadImage } from '@/utils/hook.js'
import { getClientOrderInfo, clientUploadVoucher, clientDeleteVoucher, clientConfirmOrder, getReciptCode } from '@/apis/orderApi.js'
import { transformFileToImg, getFeisuanUrl } from '@/apis/commonApi.js'
import { orderStatusEnum, supplierOrderStatusMap, supplierOrderStatusEnum, paymentMethodMap, paymentMethodEnum, invoiceStatusMap } from '@/enums/index.js'
const statusImg = {
[orderStatusEnum.WAIT_SUPPLIER_CONFIRM]: '待供应商确认',
[orderStatusEnum.ORDERED]: '已下单',
[orderStatusEnum.FINISHED]: '已完成',
[orderStatusEnum.CANCELED]: '已取消'
}
const showVoucherStatus = [
supplierOrderStatusEnum.WAIT_RECEIVE,
supplierOrderStatusEnum.WAIT_CLIENT_LOAN,
supplierOrderStatusEnum.PAYING,
supplierOrderStatusEnum.WAIT_CLIENT_PAY,
supplierOrderStatusEnum.PAY_FAIL,
supplierOrderStatusEnum.FINISHED,
supplierOrderStatusEnum.WAIT_CLIENT_REPAY,
supplierOrderStatusEnum.REPAYING,
supplierOrderStatusEnum.CANCELED
]
export default {
data() {
return {
orderInfo: {
deliveryAddress: {},
supplierOrder: []
},
statusImg,
supplierOrderStatusMap: Object.freeze(supplierOrderStatusMap),
paymentMethodMap: Object.freeze(paymentMethodMap),
supplierOrderStatusEnum: Object.freeze(supplierOrderStatusEnum),
paymentMethodEnum: Object.freeze(paymentMethodEnum),
invoiceStatusMap: Object.freeze(invoiceStatusMap),
showList: []
}
},
onLoad(option) {
if (option.orderId) {
this.init(option.orderId)
} else {
uni.showToast({
title: '订单信息错误',
icon: 'error',
success: () => {
setTimeout(() => {
back()
}, 2000)
}
})
}
},
methods: {
go2,
back,
init(orderId) {
getClientOrderInfo({
customerOrderId: orderId
}).then((res) => {
if (res) {
this.orderInfo = res
}
})
},
transformAddress(address) {
let res = ''
if (address.provinceName) {
res = `${address.provinceName}${address.cityName}${address.districtName}${address.detail}`
}
return res
},
//
transformStep(list, quantity) {
//
let step1 = [],
step2 = [],
step3 = []
//
let outboundQuantity = 0
if (list && list.length > 0) {
list.forEach((item) => {
if (item.userName && item.userName.length > 3) {
item.userName = item.userName.substr(0, 2) + '...'
}
if (item.status == '30301') {
step1.push({
title: '分切',
desc: item.userName + '\n\r' + item.createTime
})
} else if (item.status == '30302') {
step2.push({
title: '出库',
desc: item.userName + ' ' + item.quantity + '\n\r' + item.createTime
})
outboundQuantity += item.quantity
} else if (item.status == '30303') {
step3.push({
title: '完成',
desc: '已完成'
})
}
})
}
if (step1.length == 0) {
step1.push({
title: '分切',
desc: '未完成'
})
}
if (step2.length == 0) {
step2.push({
title: '出库',
desc: '未完成'
})
} else if (outboundQuantity < quantity) {
//
step2.push({
title: '出库',
desc: '未完成'
})
}
if (step3.length == 0) {
step3.push({
title: '完成',
desc: '未完成'
})
}
return [...step1, ...step2, ...step3]
},
changeShowIndex(index) {
let target = this.showList.indexOf(index)
if (target > -1) {
this.showList.splice(target, 1)
} else {
this.showList.push(index)
}
},
//
showSendImgs(status) {
return showVoucherStatus.includes(status)
},
//
showReceiveImgs(status) {
return showVoucherStatus.includes(status)
},
//
goFsPage() {
getFeisuanUrl().then((res) => {
if (res) {
// #ifdef APP-PLUS
go2('page-view', {
title: '飞算申请',
url: encodeURIComponent(res)
})
// #endif
// #ifdef H5
window ? (window.location.href = res) : ''
// #endif
}
})
},
//
confirmReceive(order) {
uni.showModal({
title: '提示',
content: '确认收货后,将不能修改,确认收货吗?',
success: (res) => {
if (res.confirm) {
clientConfirmOrder({
supplierOrderId: order.supplierOrderId
}).then((success) => {
if (success) {
uni.showToast({
title: '确认收货成功',
icon: 'success',
success: () => {
this.init(this.orderInfo.orderId)
}
})
}
})
}
}
})
},
//
confirmWxPay(mallSupplierId) {
getReciptCode({ mallSupplierId }).then((res) => {
if (res.payeeCodeUrl) {
uni.previewImage({
urls: [res.payeeCodeUrl],
current: res.payeeCodeUrl
})
} else {
uni.showToast({
title: '暂无二维码,请联系供应商',
icon: 'error'
})
}
})
},
clip(content) {
uni.setClipboardData({
data: content,
success: function () {
uni.showToast({
title: '复制成功',
icon: 'success',
duration: 2000
})
}
})
},
//
deleteVoucher(id) {
clientDeleteVoucher({ id }).then((res) => {
if (res) {
uni.showToast({
title: '删除成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
})
}
})
},
//
uploadVoucher(supplierOrderId) {
uploadImage(['album'], 5)
.then((urls) => {
if (urls) {
clientUploadVoucher({
supplierOrderId,
proofDeliveryUrl: urls
}).then((res) => {
if (res) {
uni.showToast({
title: '上传成功',
icon: 'success',
success: () => {
setTimeout(() => {
this.init(this.orderInfo.orderId)
}, 1000)
}
})
}
})
}
})
.catch((e) => {
console.log('上传失败:', e)
uni.showToast({
title: '上传失败',
icon: 'fail'
})
})
},
//
viewContract() {
let urls = this.orderInfo.contractUrls
if (urls && urls.length > 0) {
let promises = []
urls.forEach((item) => {
promises.push(transformFileToImg({ fileUrl: item }))
})
Promise.all(promises).then((res) => {
let list = []
res.forEach((item) => {
list.push(item.imgUrl)
})
uni.previewImage({
urls: list,
current: list[0]
})
})
}
}
}
}
</script>
<style lang="scss" scoped>
.status-area {
padding: 24rpx 32rpx;
width: 750rpx;
background-image: linear-gradient(90deg, #ff4d2e 6%, #ff952f 100%);
}
.address-area {
padding: 0 32rpx;
width: 750rpx;
background-color: #ffffff;
.footer {
padding: 24rpx 0;
background-color: #ffffff;
border-top: 1px solid #e5e5e5;
}
}
.order-area {
.header {
padding: 24rpx 32rpx;
word-break: break-all;
background: #e5f1ff;
width: 750rpx;
}
.order-header {
padding: 24rpx 32rpx;
word-break: break-all;
background: #fff;
width: 750rpx;
border-bottom: 2rpx dashed #d8d8d8;
margin-bottom: 20rpx;
}
.order-row {
width: 750rpx;
padding: 0 32rpx;
margin-bottom: 18rpx;
font-size: 28rpx;
color: #555555;
}
.footer {
background-color: #ffffff;
width: 750rpx;
overflow: hidden;
margin-bottom: 20rpx;
.header {
padding: 24rpx 32rpx;
background-color: #fff;
}
.imgs {
padding: 16rpx 32rpx 32rpx;
min-height: 120rpx;
}
}
}
.fee {
padding: 24rpx 32rpx;
width: 750rpx;
background-color: #ffffff;
margin: 20rpx 0;
}
.order-footer {
padding: 0rpx 32rpx;
width: 750rpx;
background-color: #ffffff;
.order-row {
padding: 24rpx 0;
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
.label {
font-size: 28rpx;
color: #000000;
}
.value {
font-size: 28rpx;
color: #333333;
}
}
}
.button {
height: 88rpx;
width: 220rpx;
background-color: #fff;
line-height: 84rpx;
border: 1px solid #007aff;
border-radius: 10rpx;
text-align: center;
font-size: 30rpx;
color: #007aff;
}
.button-item {
padding: 0rpx 24rpx;
height: 46rpx;
display: flex;
justify-content: center;
align-items: center;
background: #007aff;
border-radius: 20rpx;
font-size: 26rpx;
color: #ffffff;
}
.default-upload {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
background-color: #dcdee0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
.icon {
width: 56rpx;
height: 56rpx;
margin-bottom: 8rpx;
}
}
.upload_img {
width: 120rpx;
height: 120rpx;
border-radius: 10rpx;
background-color: #dcdee0;
display: flex;
flex-direction: column;
justify-content: center;
align-items: center;
position: relative;
margin-right: 12rpx;
overflow: hidden;
.close-icon {
position: absolute;
top: 0;
right: 0;
z-index: 5;
}
}
</style>

271
pages/order-list/index.vue

@ -0,0 +1,271 @@
<template>
<view class="content">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="订单列表"></uni-nav-bar>
<view class="status-bar">
<view
v-for="item in statusBarArray"
:key="item.value"
:class="{ box: true, 'box--selected': condition.status == item.value }"
@click="selectStatus(item.value)"
>
{{ item.label }}
</view>
</view>
<view class="list-area">
<scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback">
<view v-for="item in list" :key="item.orderId" class="order-area" @click="goDetail(item)">
<view class="order-header">
<view class="left">
<text style="font-size: 30rpx; color: #000000; font-weight: 600">{{ item.orderId }}</text>
<text style="font-size: 26rpx; color: #888888; margin-top: 16rpx">{{ dateTimeFormat(item.createTime, 'yyyy/mm/dd') }}</text>
</view>
<view class="right">
<text style="font-size: 30rpx; color: #ff5368; font-weight: 500">{{ orderStatusMap[item.status] }}</text>
</view>
</view>
<view class="order-content" v-for="order in item.supplierOrderList" :key="order.supplierOrderId">
<view class="header">
<text style="font-size: 30rpx; color: #000000">{{ order.supplierEnterpriseName }}</text>
<text style="font-size: 30rpx; color: #888888; font-weight: 500">{{ supplierOrderStatusMap[order.status] }}</text>
</view>
<view v-for="(target, index) in order.orderItems" :key="target.productId" :class="{ 'order-item': true, border: index > 0 }">
<image class="img" :src="target.productImg || '/static/imgs/order/paper-default-icon.png'"></image>
<view class="right">
<text style="font-size: 30rpx; color: #000000">{{ target.productName }}</text>
<text style="font-size: 26rpx; color: #888888; margin-top: 26rpx; word-break: break-all">{{ transformTarget(target) }}</text>
</view>
</view>
</view>
<view class="order-footer">
<view class="left">
<text style="font-size: 26rpx; color: #888888; margin-right: 8rpx">交货时间:</text>
<text style="font-size: 26rpx; color: #333333">{{ item.deliveryLeadtime || '-' }}</text>
</view>
<view class="right">
<text style="font-size: 30rpx; color: #ff5368"> {{ item.totalOfferPrice }}</text>
</view>
</view>
</view>
</scroll-list>
</view>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
import { dateTimeFormat } from '@/utils/index.js'
import { orderStatusArray, orderStatusEnum, orderStatusMap, supplierOrderStatusMap } from '@/enums/index.js'
import { getOrderList } from '@/apis/orderApi.js'
export default {
data() {
return {
condition: {
status: orderStatusEnum.ALL,
pageNum: 0, //
pageSize: 10
},
option: {
size: 10,
auto: true,
emptyText: '暂无订单~',
background: '#F7F8FA',
emptyImage: '/static/imgs/order/order-empty.png'
},
list: [],
statusBarArray: Object.freeze(orderStatusArray.filter((item) => item.value !== orderStatusEnum.CANCELED)),
orderStatusMap: Object.freeze(orderStatusMap),
supplierOrderStatusMap: Object.freeze(supplierOrderStatusMap)
}
},
methods: {
go2,
back,
dateTimeFormat,
getList() {
return new Promise((resolve, reject) => {
getOrderList({ ...this.condition })
.then((res) => {
if (res) {
if (this.condition.pageNum == 1) {
this.list = res.records
} else {
this.list = this.list.concat(res.records)
}
resolve({ list: this.list, total: res.total })
} else {
reject()
}
})
.catch((err) => {
reject(err)
})
})
},
downCallback() {
this.condition.pageNum = 1
this.getList()
.then(({ list, total }) => {
this.$refs.list.refreshSuccess({ list, total })
})
.catch(() => {
this.$refs.list.refreshFail()
})
},
upCallback(page) {
this.condition.pageNum++
this.getList()
.then(({ list, total }) => {
this.$refs.list.loadSuccess({ list, total })
})
.catch(() => {
this.$refs.list.loadFail()
})
},
selectStatus(status) {
this.condition.status = status
this.downCallback()
},
transformTarget(target) {
let result = ''
if (target.categoryName) {
result += `${target.categoryName}`
}
if (target.brandName) {
result += `/${target.brandName}`
}
if (target.gramWeight) {
result += `/${target.gramWeight}g`
}
if (target.length && target.width) {
result += `/${target.width}*${target.length}`
}
if (target.pieceQuantity) {
result += `/${target.pieceQuantity}`
}
return result
},
//
goDetail(order) {
if (order.status === orderStatusEnum.WAIT_CONFIRM) {
go2('order-make', { orderId: order.orderId })
} else {
go2('order-detail', { orderId: order.orderId })
}
}
},
onLoad(option) {
if (option.status) {
this.condition.status = option.status
}
}
}
</script>
<style lang="scss" scoped>
.content {
display: flex;
flex-direction: column;
flex: 1;
height: 100vh;
.status-bar {
flex-grow: 0;
flex-shrink: 0;
display: flex;
align-items: center;
justify-content: space-between;
padding: 0 32rpx;
border-bottom: 2rpx solid #f8f8f8;
background-color: #fff;
height: 90rpx;
.box {
height: 86rpx;
flex-grow: 0;
flex-shrink: 0;
color: #000000;
font-size: 28rpx;
display: flex;
align-items: center;
justify-content: center;
border-bottom: 4rpx solid #f8f8f8;
}
.box--selected {
border-bottom: 4rpx solid #007aff;
color: #007aff;
}
}
.list-area {
flex-grow: 1;
overflow: hidden;
.order-area {
width: 750rpx;
margin-bottom: 20rpx;
background-color: #fff;
.order-header {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 18rpx 32rpx;
border-bottom: 2rpx solid #f8f8f8;
.left {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
}
}
.order-content {
border-bottom: 2rpx solid #f8f8f8;
.header {
display: flex;
align-items: flex-start;
justify-content: space-between;
padding: 24rpx 32rpx;
border-bottom: 2rpx solid #f8f8f8;
}
.order-item {
display: flex;
align-items: center;
justify-content: flex-start;
width: 686rpx;
margin: 24rpx 32rpx;
.img {
width: 100rpx;
height: 100rpx;
margin-right: 20rpx;
flex-grow: 0;
flex-shrink: 0;
}
.right {
display: flex;
flex-direction: column;
align-items: flex-start;
justify-content: flex-start;
}
}
.border {
border-top: 2rpx solid #f8f8f8;
}
}
.order-footer {
display: flex;
align-items: center;
justify-content: space-between;
padding: 24rpx 32rpx;
border-bottom: 2rpx solid #f8f8f8;
.left {
display: flex;
flex-direction: row;
align-items: center;
justify-content: flex-start;
}
.right {
display: flex;
flex-direction: column;
align-items: center;
justify-content: flex-end;
}
}
}
}
}
</style>

130
pages/order-make/index.vue

@ -97,16 +97,16 @@
<view class="left">
<image class="img" src="/static/imgs/order/month-pay-icon.png"></image>
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用月结额度</text>
<text v-if="payMap['month'] != null" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['month'].availableCreditLine }}</text>
<text v-if="payMap['month'].isShow" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['month'].availableCreditLine }}</text>
</view>
<image
v-if="payMap['month'] != null && payMap['month'].availableCreditLine > orderInfo.totalOfferPrice"
v-if="payMap['month'].isShow && payMap['month'].availableCreditLine > orderInfo.totalOfferPrice"
@click="selectPayMethod('month')"
class="img"
:src="currentPayType == 'month' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'"
></image>
<text v-if="payMap['month'] == null" style="font-size: 28rpx; color: #888888">待申请</text>
<text v-if="payMap['month'] != null && payMap['month'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888">
<text v-if="!payMap['month'].isShow" style="font-size: 28rpx; color: #888888">待申请</text>
<text v-if="payMap['month'].isShow && payMap['month'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888">
余额不足
</text>
</view>
@ -114,16 +114,16 @@
<view class="left">
<image class="img" src="/static/imgs/order/fs-pay-icon.png"></image>
<text style="font-size: 30rpx; color: #000000; margin: 0 16rpx">使用飞算资金</text>
<text v-if="payMap['fs'] != null" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['fs'].availableCreditLine }}</text>
<text v-if="payMap['fs'].isShow" style="font-size: 28rpx; color: #888888">剩余额度: {{ payMap['fs'].availableCreditLine }}</text>
</view>
<image
v-if="payMap['fs'] != null && payMap['fs'].availableCreditLine > orderInfo.totalOfferPrice"
v-if="payMap['fs'].isShow && payMap['fs'].availableCreditLine > orderInfo.totalOfferPrice"
@click="selectPayMethod('fs')"
class="img"
:src="currentPayType == 'fs' ? '/static/imgs/order/selected-icon.png' : '/static/imgs/order/select-icon.png'"
></image>
<text v-if="payMap['fs'] == null" style="font-size: 28rpx; color: #888888">待申请</text>
<text v-if="payMap['fs'] != null && payMap['fs'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888">
<text v-if="!payMap['fs'].isShow" style="font-size: 28rpx; color: #888888">待申请</text>
<text v-if="payMap['fs'].isShow && payMap['fs'].availableCreditLine < orderInfo.totalOfferPrice" style="font-size: 28rpx; color: #888888">
余额不足
</text>
</view>
@ -156,7 +156,7 @@ import { go2, back, getCache } from '@/utils/hook.js'
import { getPreOrderInfo, getDefaultAddress, submitClientOrder, calcNotInvoiceOrderInfo } from '@/apis/orderApi'
import { getFsCredit, getMonthCredit } from '@/apis/commonApi'
import { isObject } from '@/utils/is'
import { invoiceStatusEnum } from '@/enums/index'
import { invoiceStatusEnum, paymentMethodEnum } from '@/enums/index'
export default {
data() {
@ -166,20 +166,22 @@ export default {
receivedTime: null
},
invoiceInfo: {}, //
noInvoiceInfo: null, //
deliveryAddress: {},
currentPayType: null,
payMap: {
month: {
availableCreditLine: 0,
value: 2
value: paymentMethodEnum.MONTHLY_PAY,
isShow: false
},
fs: {
availableCreditLine: 0,
value: 4
value: paymentMethodEnum.FLY_PAY,
isShow: false
},
wxpay: {
value: 1
value: paymentMethodEnum.WECHAT_PAY,
isShow: false
}
},
loading: false,
@ -194,6 +196,7 @@ export default {
if (res) {
this.orderInfo = res
this.invoiceInfo = res
this.completePayment(res.paymentMethods)
}
})
} else {
@ -209,7 +212,13 @@ export default {
}
},
created() {
this.init()
//
getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => {
if (res) {
this.deliveryAddress = res
this.deliveryAddress.addressId = res.id
}
})
},
onShow() {
let address = getCache('address')
@ -227,21 +236,16 @@ export default {
selectInvoice(type) {
this.isInvoice = type
if (!type) {
//
if (this.noInvoiceInfo) {
this.orderInfo = this.noInvoiceInfo
} else {
//
calcNotInvoiceOrderInfo({
customerOrderId: this.orderInfo.orderId,
invoiceOrNot: invoiceStatusEnum.NO_INVOICE // 1:
}).then((res) => {
if (res) {
this.noInvoiceInfo = res
this.orderInfo = res
}
})
}
//
calcNotInvoiceOrderInfo({
customerOrderId: this.orderInfo.orderId,
invoiceOrNot: invoiceStatusEnum.NO_INVOICE, // 1:
paymentMethod: this.payMap[this.currentPayType].value
}).then((res) => {
if (res) {
this.orderInfo = res
}
})
} else {
this.orderInfo = this.invoiceInfo
}
@ -287,7 +291,14 @@ export default {
icon: 'success',
success: () => {
setTimeout(() => {
window.location.href = res.signUrl
// #ifdef APP-PLUS
go2('page-view', { title: '合同签署', url: encodeURIComponent(res.signUrl) })
// #endif
// #ifdef H5
if (window) {
window.location.href = res.signUrl
}
// #endif
}, 1000)
}
})
@ -297,37 +308,62 @@ export default {
this.loading = false
})
},
init() {
//
completePayment(paymentMethods) {
let map = {
[paymentMethodEnum.MONTHLY_PAY]: 'month',
[paymentMethodEnum.FLY_PAY]: 'fs',
[paymentMethodEnum.WECHAT_PAY]: 'wxpay'
}
if (paymentMethods && paymentMethods.length > 0) {
for (let item of paymentMethods) {
//
if (item.value == this.payMap.fs.value) {
this.payMap.fs.isShow = true
this.completeFsCredit()
}
//
if (item.value == this.payMap.month.value) {
this.payMap.month.isShow = true
this.completeMonthCredit()
}
//
if (item.value == this.payMap.wxpay.value) {
this.payMap.wxpay.isShow = true
}
if (item.isDefault) {
this.currentPayType = map[item.value]
}
}
}
},
//
completeMonthCredit() {
getMonthCredit({
enterpriseId: this.$store.state.companyInfo.id,
supplierId: this.$store.state.supplierId
}).then((res) => {
if (res) {
if (res.supplierCredit !== null) {
this.payMap['month'].availableCreditLine = res.supplierCredit
} else {
this.payMap['month'] = null
this.payMap['month'].availableCreditLine = res.supplierCredit
if (this.payMap['month'].availableCreditLine < this.orderInfo.totalOfferPrice && this.currentPayType == 'month') {
this.currentPayType = null
}
} else {
this.payMap['month'] = null
this.payMap['month'].isShow = false
}
})
//
},
//
completeFsCredit() {
getFsCredit({
enterpriseId: this.$store.state.companyInfo.id
}).then((res) => {
if (isObject(res)) {
if (res) {
this.payMap['fs'].availableCreditLine = res.availableCreditLine
if (this.payMap['fs'].availableCreditLine < this.orderInfo.totalOfferPrice && this.currentPayType == 'fs') {
this.currentPayType = null
}
} else {
this.payMap['fs'] = null
}
})
//
getDefaultAddress({ enterpriseId: this.$store.state.companyInfo.id }).then((res) => {
if (res) {
this.deliveryAddress = res
this.deliveryAddress.addressId = res.id
this.payMap['fs'].isShow = false
}
})
}

BIN
static/imgs/.DS_Store

BIN
static/imgs/digital-workshops/个人中心.sketch

BIN
static/imgs/mine/.DS_Store

BIN
static/imgs/mine/address-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 7.1 KiB

BIN
static/imgs/mine/certification-icon.png

Before After
Width: 68  |  Height: 73  |  Size: 5.9 KiB

BIN
static/imgs/mine/certified-icon.png

Before After
Width: 100  |  Height: 32  |  Size: 4.9 KiB

BIN
static/imgs/mine/client-default.png

Before After
Width: 140  |  Height: 140  |  Size: 13 KiB

BIN
static/imgs/mine/contract-icon.png

Before After
Width: 74  |  Height: 74  |  Size: 8.6 KiB

BIN
static/imgs/mine/default-avatar.png

Before After
Width: 156  |  Height: 156  |  Size: 17 KiB

BIN
static/imgs/mine/enquiry-icon.png

Before After
Width: 74  |  Height: 73  |  Size: 8.4 KiB

BIN
static/imgs/mine/enterprise-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 7.2 KiB

BIN
static/imgs/mine/logout-icon.png

Before After
Width: 24  |  Height: 25  |  Size: 541 B

BIN
static/imgs/mine/mine-top-bg.png

Before After
Width: 750  |  Height: 377  |  Size: 336 KiB

BIN
static/imgs/mine/non-certified-icon.png

Before After
Width: 100  |  Height: 32  |  Size: 4.5 KiB

BIN
static/imgs/mine/order-all-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 3.9 KiB

BIN
static/imgs/mine/order-done-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 3.9 KiB

BIN
static/imgs/mine/order-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 5.2 KiB

BIN
static/imgs/mine/order-ing-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 4.4 KiB

BIN
static/imgs/mine/order-ready-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 3.6 KiB

BIN
static/imgs/mine/order-supplier-ready-icon.png

Before After
Width: 68  |  Height: 68  |  Size: 3.3 KiB

BIN
static/imgs/mine/user-avatar.png

Before After
Width: 156  |  Height: 156  |  Size: 5.1 KiB

15
store/index.js

@ -53,9 +53,24 @@ if (!store) {
nextPage: {
name: '',
data: {}
},
/**
* 监听cache的type即可,每次取值后都必须调用commit('resetCache')
*/
cache: {
type: 'none',
data: null
}
},
mutations: {
setCache(state, { type, data }) {
state.cache.type = type
state.cache.data = data
},
resetCache(state) {
state.cache.type = 'none'
state.cache.data = null
},
setUecToken(state, token) {
try {
uni.setStorageSync('uecToken', token)

27
utils/hook.js

@ -343,3 +343,30 @@ export function saveImageToPhotosAlbum(path) {
})
})
}
/**
* 根据类型获取缓存
* @param {string} type 缓存类型
* @returns object 缓存数据
*/
export function getCache(type) {
let data = null
if (store.state.cache.type === type) {
data = store.state.cache.data
// 防止同一事件循环的数据竞争
setTimeout(() => {
store.commit('resetCache')
})
}
return data
}
/**
* 设置缓存
* @param {string} type 缓存类型
* @param {object} data 缓存数据
* @returns null
*/
export function setCache(type, data) {
store.commit('setCache', { type, data })
}
Loading…
Cancel
Save