Browse Source

链接校验、个人中心

devlop
邓雄飞 4 years ago
parent
commit
25eb5dde52
14 changed files with 426 additions and 29 deletions
  1. 14
      apis/orderApi.js
  2. 7
      components/scroll-list/scroll-list.vue
  3. 84
      enums/index.js
  4. 6
      manifest.json
  5. 8
      pages.json
  6. 18
      pages/error/index.vue
  7. 12
      pages/login/index.vue
  8. 29
      pages/mine/index.vue
  9. 263
      pages/order-list/index.vue
  10. BIN
      static/imgs/order/order-empty.png
  11. BIN
      static/imgs/order/paper-default-icon.png
  12. 4
      store/index.js
  13. 6
      utils/index.js
  14. 4
      utils/is.js

14
apis/orderApi.js

@ -0,0 +1,14 @@
import http from '../utils/http/index.js'
/**
* 获取客户订单列表
* @param {object} data 获取验证码参数
* @returns {Promise<object[]>}
* swagger: http://api-ops-yyt-test.qniao.cn//base-paper-trading/swagger-ui/index.html?urls.primaryName=CustomerApi#/%E5%8E%9F%E7%BA%B8%E8%AE%A2%E5%8D%95/getCustomerOrderListPageUsingGET
*/
export const getOrderList = (data) => {
return http.get({
url: '/base-paper-trading/get/customer/order/list/page',
data
})
}

7
components/scroll-list/scroll-list.vue

@ -580,7 +580,7 @@ export default {
.scroll-content {
height: 100%;
display: flex;
will-change: transform;
// will-change: transform;
flex-direction: column;
.pull-down-wrap {
left: 0;
@ -627,10 +627,11 @@ export default {
margin: auto;
display: flex;
align-items: center;
margin-bottom: 400rpx;
flex-direction: column;
.empty-image {
width: 200rpx;
height: 200rpx;
width: 600rpx;
height: 600rpx;
}
.empty-text {
color: #606266;

84
enums/index.js

@ -107,3 +107,87 @@ export const fsAuditStatus = {
PASS: 2,
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 已发货在H5客户端显示 待收货/30107 ,待客户借款/30207,支付中/30208,待客户支付/30214,付款失败/30211,已完成/30213,待客户还款/30217,已取消/30212,还款中/30216
*/
export const supplierOrderStatusEnum = {
WAIT_CLIENT_CONFIRM: 30202,
WAIT_SUPPLIER_CONFIRM: 30205,
WAIT_DELIVERY: 30106,
WAIT_RECEIVE: 30107,
WAIT_CLIENT_LOAN: 30207,
PAYING: 30208,
WAIT_CLIENT_PAY: 30214,
PAY_FAIL: 30211,
FINISHED: 30213,
WAIT_CLIENT_REPAY: 30217,
REPAYING: 30216,
CANCELED: 30212
}
export const supplierOrderStatusMap = {
[supplierOrderStatusEnum.WAIT_CLIENT_CONFIRM]: '待客户确认',
[supplierOrderStatusEnum.WAIT_SUPPLIER_CONFIRM]: '待供应商确认',
[supplierOrderStatusEnum.WAIT_DELIVERY]: '待发货',
[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]: '已取消'
}

6
manifest.json

@ -1,6 +1,6 @@
{
"name" : "uniapp-demo",
"appid" : "",
"name" : "纸掌柜",
"appid" : "__UNI__34A22DC",
"description" : "",
"versionName" : "1.0.0",
"versionCode" : "100",
@ -85,7 +85,7 @@
"vueVersion" : "2",
"h5" : {
"router" : {
"mode" : "history"
"mode" : "hash"
}
}
}

8
pages.json

@ -67,6 +67,14 @@
"navigationStyle": "custom"
}
},
{
"path": "pages/order-list/index",
"style": {
"navigationBarTitleText": "订单列表",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/test/index",
"style": {

18
pages/error/index.vue

@ -1,5 +1,11 @@
<template>
<view>error</view>
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="未授权页面"></uni-nav-bar>
<view class="container">
<image style="width: 560rpx; height: 320rpx; margin-bottom: 50rpx" src="https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/error.png"></image>
<text style="font-size: 32px; color: #333333">请联系纸盘商获取正确地址</text>
</view>
</view>
</template>
<script>
@ -15,4 +21,12 @@ export default {
}
</script>
<style lang="scss" scoped></style>
<style lang="scss" scoped>
.container {
display: flex;
justify-content: center;
align-items: center;
width: 750rpx;
margin-top: 240rpx;
}
</style>

12
pages/login/index.vue

@ -139,12 +139,12 @@ export default {
store.commit('setToken', token)
//
const nextPage = store.state.nextPage
let page = null
if (nextPage.name) {
go2(nextPage.name, nextPage.data, true)
} else {
//
this.setAccountInfo()
page = { url: nextPage.name, data: nextPage.data, isRedirect: true }
}
//
this.setAccountInfo(page)
store.commit('removeNextPage')
}, 1000)
}
@ -154,13 +154,13 @@ export default {
}
})
},
setAccountInfo() {
setAccountInfo(page = { url: 'store', data: {}, isRedirect: true }) {
getBaseInfo({}, true).then((res) => {
if (res) {
if (!res.enterpriseList || res.enterpriseList.length === 0) {
go2('enterprise-info', { operation: 'add' }, true)
} else {
go2('store')
go2(page.url, page.data, page.isRedirect)
}
}
})

29
pages/mine/index.vue

@ -36,26 +36,30 @@
</view>
<view class="card-area" style="margin-top: -94rpx; z-index: 10">
<view class="header">
<text style="font-size: 30rpx; color: rgba(0, 0, 0, 0.85); font-weight: 600">其他工具</text>
<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: #000000">查看更多订单</text>
<uni-icons style="margin-left: 16rpx" type="right" size="10"></uni-icons>
</view>
</view>
<view class="order-area">
<view class="icon-item">
<view class="icon-item" @click="loginGo2('order-list', { status: orderStatusEnum.ALL })">
<image class="icon" src="/static/imgs/mine/order-all-icon.png"></image>
<text class="label">全部订单</text>
</view>
<view class="icon-item">
<view class="icon-item" @click="loginGo2('order-list', { status: orderStatusEnum.WAIT_CONFIRM })">
<image class="icon" src="/static/imgs/mine/order-ready-icon.png"></image>
<text class="label">待确认</text>
</view>
<view class="icon-item">
<view class="icon-item" @click="loginGo2('order-list', { status: orderStatusEnum.WAIT_SUPPLIER_CONFIRM })">
<image class="icon" src="/static/imgs/mine/order-supplier-ready-icon.png"></image>
<text class="label">待供应商确认</text>
</view>
<view class="icon-item">
<view class="icon-item" @click="loginGo2('order-list', { status: orderStatusEnum.ORDERED })">
<image class="icon" src="/static/imgs/mine/order-ing-icon.png"></image>
<text class="label">已下单</text>
</view>
<view class="icon-item">
<view class="icon-item" @click="loginGo2('order-list', { status: orderStatusEnum.FINISHED })">
<image class="icon" src="/static/imgs/mine/order-done-icon.png"></image>
<text class="label">已完成</text>
</view>
@ -105,16 +109,15 @@
</view>
</view>
</view>
<view @click="go2('test')">test</view>
<view @click="go2('enterprise-info')">enterprise-info</view>
<view @click="loginGo2('test')">test</view>
<view @click="loginGo2('enterprise-info')">enterprise-info</view>
</view>
</template>
<script>
import { exit, go2 } from '@/utils/hook.js'
import { fddEnterpriseStatus, fsAuditStatus } from '@/enums/index.js'
import { exit, go2, loginGo2 } from '@/utils/hook.js'
import { fddEnterpriseStatus, fsAuditStatus, orderStatusEnum } from '@/enums/index.js'
import { getVerifyUrl, getFsCredit } from '@/apis/commonApi.js'
import { dateTimeFormat } from '@/utils/index.js'
export default {
data() {
@ -126,10 +129,12 @@ export default {
usedCreditLine: 0,
creditLine: 0
},
fsAuditStatus: Object.freeze(fsAuditStatus)
fsAuditStatus: Object.freeze(fsAuditStatus),
orderStatusEnum: Object.freeze(orderStatusEnum)
}
},
methods: {
loginGo2,
logout() {
exit()
},

263
pages/order-list/index.vue

@ -0,0 +1,263 @@
<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">
<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
}
},
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>

BIN
static/imgs/order/order-empty.png

Before After
Width: 560  |  Height: 560  |  Size: 45 KiB

BIN
static/imgs/order/paper-default-icon.png

Before After
Width: 100  |  Height: 100  |  Size: 16 KiB

4
store/index.js

@ -19,7 +19,7 @@ let qnToken = null,
uecToken = null,
searchHistory = null,
/**
* @value supplierId 当前被分的供应商id
* @value supplierId 当前被分的供应商id
*/
supplierId = null
const companyInfoParams = ['id', 'name', 'fddEnterpriseStatus']
@ -51,7 +51,7 @@ const store = new Vuex.Store({
qnToken: qnToken || '', // token
supplierId: supplierId || '', // 供应商id
userInfo: userInfo || {}, // 用户信息
companyInfo: companyInfo || {}, // 纸盘商信息
companyInfo: companyInfo || {}, // 印包厂信息
nextPage: {
name: '',
data: {}

6
utils/index.js

@ -1,12 +1,16 @@
import env from '@/env/index.js'
import store from '@/store/index.js'
import { isDate } from './is.js'
/**
* 日期格式化样例 yyyy-mm-dd hh:MM:ss
* @param date Date 需要转换的日期
* @param fmt string 转化的格式 yyyy-mm-dd hh:MM:ss
*/
export const dateTimeFormat = (date, fmt) => {
if (!date) {
if (!isDate(date)) {
date = new Date(date)
}
if (!date || isNaN(date.getTime())) {
throw new Error('日期不正确')
}
let ret

4
utils/is.js

@ -15,3 +15,7 @@ export function isObject(val) {
export function isArray(val) {
return is(val, 'Array')
}
export function isDate(val) {
return is(val, 'Date')
}
Loading…
Cancel
Save