Browse Source

购物车和个人中心

devlop
mo-bai 4 years ago
parent
commit
ae2f2aea54
14 changed files with 686 additions and 10 deletions
  1. 29
      apis/enquiryListApi.js
  2. 22
      apis/orderApi.js
  3. 1
      components/qn-data-picker/qn-data-picker.vue
  4. 1
      components/qn-datetime-picker/qn-datetime-picker.vue
  5. 18
      pages.json
  6. 6
      pages/cart/index.vue
  7. 257
      pages/contract-manage/index.vue
  8. 337
      pages/enquiry-list/index.vue
  9. 7
      pages/mall/index.vue
  10. 8
      pages/mine/index.vue
  11. 4
      pages/page-view/index.vue
  12. 5
      pages/paper-details/index.vue
  13. BIN
      static/imgs/.DS_Store
  14. 1
      utils/hook.js

29
apis/enquiryListApi.js

@ -0,0 +1,29 @@
import http from '../utils/http/index.js'
// 获取获取询价结果列表
export function getEnquiryOrder(data) {
return http.get(
{
url: '/base-paper-trading/get/enquiry-order/result-list',
data
},
{
hideLoading: true
}
)
}
/**
* 询价单去下单
* swagger:https://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/createCustomerOrderByEnquiryUsingPOST
*
*/
export function createByEnquiry(data) {
return http.post(
{
url: '/base-paper-trading/buyer/paper/goods/reserve/by-enquiry',
data
},
{
isEncrypt: true
}
)
}

22
apis/orderApi.js

@ -137,3 +137,25 @@ export function getReciptCode(data) {
data data
}) })
} }
/**
* 供应商获取合同列表
* @param {object} data signDate enterpriseId type
*/
export function getContractList(data) {
return http.get({
url: '/base-paper-trading/supplier/get/contract-list',
data
})
}
/**
* 获取已签署合同企业列表
* @param {object} data enterpriseId
*/
export function getCooperationList(data) {
return http.get({
url: '/base-paper-trading/supplier/get/contract-enterprise-list',
data
})
}

1
components/qn-data-picker/qn-data-picker.vue

@ -375,6 +375,7 @@ export default {
} }
.selected-item { .selected-item {
width: 100%;
flex-direction: row; flex-direction: row;
padding: 0 1px; padding: 0 1px;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */

1
components/qn-datetime-picker/qn-datetime-picker.vue

@ -776,6 +776,7 @@ export default {
background-color: #fff; background-color: #fff;
color: #666; color: #666;
font-size: 14px; font-size: 14px;
width: 100%;
} }
.uni-date-x--border { .uni-date-x--border {

18
pages.json

@ -118,7 +118,23 @@
{ {
"path": "pages/add-address-manage/index", "path": "pages/add-address-manage/index",
"style": { "style": {
"navigationBarTitleText": "地址管理",
"navigationBarTitleText": "添加地址",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/contract-manage/index",
"style": {
"navigationBarTitleText": "合同管理",
"enablePullDownRefresh": false,
"navigationStyle": "custom"
}
},
{
"path": "pages/enquiry-list/index",
"style": {
"navigationBarTitleText": "询价列表",
"enablePullDownRefresh": false, "enablePullDownRefresh": false,
"navigationStyle": "custom" "navigationStyle": "custom"
} }

6
pages/cart/index.vue

@ -37,7 +37,7 @@
<view class="weight">预估重量{{ subItem.weight }}</view> <view class="weight">预估重量{{ subItem.weight }}</view>
<view class="price-row"> <view class="price-row">
<view class="value">¥{{ subItem.price }}</view> <view class="value">¥{{ subItem.price }}</view>
<view><qnInputNumber :quantity="subItem.quantity" @input="change($event, subItem)" /></view>
<view><qn-input-number :quantity="subItem.quantity" @input="change($event, subItem)" /></view>
</view> </view>
</view> </view>
</view> </view>
@ -431,6 +431,10 @@ export default {
} }
} }
.footer-box { .footer-box {
position: fixed;
bottom: 0;
left: 0;
right: 0;
.check-text { .check-text {
font-size: 24rpx; font-size: 24rpx;
color: #333333; color: #333333;

257
pages/contract-manage/index.vue

@ -0,0 +1,257 @@
<template>
<view class="content">
<uni-nav-bar left-icon="back" statusBar @clickLeft="back" typeBar fixed title="合同管理"></uni-nav-bar>
<view class="condition-area flex-row-center-start">
<qn-data-picker
v-model="condition.customerEnterpriseId"
style="flex-shrink: 0; max-width: 300rpx"
text="right"
:border="false"
placeholder="请选择客户"
popup-title="请选择客户"
:map="{ text: 'name', value: 'id' }"
:clear-icon="false"
:localdata="customerList"
></qn-data-picker>
<qn-data-picker
style="flex-shrink: 0"
v-model="condition.type"
text="right"
:border="false"
placeholder="请选择"
popup-title="请选择合同类型"
:map="{ text: 'name', value: 'id' }"
:clear-icon="false"
:localdata="typeList"
></qn-data-picker>
<qn-datetime-picker style="flex-shrink: 1" type="date" v-model="condition.signDate" :border="false"></qn-datetime-picker>
</view>
<scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback">
<view class="contract-item" v-for="item in list" :key="item.id">
<view class="header flex-col-start-start">
<view :class="'icon ' + typeMap[item.type].class">
<text style="font-size: 28rpx; color: #ffffff">{{ typeMap[item.type].label }}</text>
</view>
<text class="title">{{ item.customerEnterpriseName }}</text>
<view class="row flex-row-center-start" style="margin-top: 0rpx">
<text class="label">合同编号:</text>
<text class="value">{{ item.contractNo }}</text>
</view>
<view class="row flex-row-center-start">
<text class="label">签署时间:</text>
<text class="value">{{ item.signDate || '-' }}</text>
</view>
<view class="row flex-row-center-start">
<text class="label">合同金额:</text>
<text class="value">{{ item.totalOfferPrice || '-' }}</text>
</view>
</view>
<view class="footer flex-row-center-space">
<text style="font-size: 30rpx; color: #888888">操作人: {{ item.userName }}</text>
<text style="font-size: 28rpx; color: #007aff" @click="viewContract(item.downloadUrl)">查看</text>
</view>
</view>
</scroll-list>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
import { transformFileToImg } from '@/apis/commonApi.js'
import { dateTimeFormat } from '@/utils/index.js'
import { getContractList, getCooperationList } from '@/apis/orderApi.js'
import { financeStatusMap, contractTypeMap, contractTypeEnum } from '@/enums/index.js'
const typeList = [
{
id: '',
name: '全部'
},
{
id: contractTypeEnum.ORDER_CONTRACT,
name: contractTypeMap[contractTypeEnum.ORDER_CONTRACT]
},
{
id: contractTypeEnum.GUARANTEE_CONTRACT,
name: contractTypeMap[contractTypeEnum.GUARANTEE_CONTRACT]
}
]
const typeMap = {
[contractTypeEnum.ORDER_CONTRACT]: {
class: 'icon__ORDER_CONTRACT',
label: contractTypeMap[contractTypeEnum.ORDER_CONTRACT]
},
[contractTypeEnum.GUARANTEE_CONTRACT]: {
class: 'icon__GUARANTEE_CONTRACT',
label: contractTypeMap[contractTypeEnum.GUARANTEE_CONTRACT]
}
}
export default {
data() {
return {
customerList: [
{
id: '',
name: '全部客户'
}
],
typeList: Object.freeze(typeList),
financeStatusMap: Object.freeze(financeStatusMap),
typeMap: Object.freeze(typeMap),
condition: {
customerEnterpriseId: '',
type: '',
signDate: null
},
pagination: {
pageNum: 0, //
pageSize: 10
},
list: [],
option: {
size: 10,
auto: true,
emptyText: '暂无数据~',
background: '#F7F8FA'
}
}
},
methods: {
go2,
back,
dateTimeFormat,
getList() {
return new Promise((resolve, reject) => {
getContractList({ ...this.condition, ...this.pagination })
.then((res) => {
if (res) {
if (res.current == 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.pagination.pageNum = 1
this.getList()
.then(({ list, total }) => {
this.$refs.list.refreshSuccess({ list, total })
})
.catch(() => {
this.$refs.list.refreshFail()
})
},
upCallback(page) {
this.pagination.pageNum++
this.getList()
.then(({ list, total }) => {
this.$refs.list.loadSuccess({ list, total })
})
.catch(() => {
this.$refs.list.loadFail()
})
},
//
viewContract(url) {
if (url) {
transformFileToImg({ fileUrl: url }).then((res) => {
uni.previewImage({ urls: [res.imgUrl], current: res.imgUrl })
})
}
}
},
watch: {
condition: {
handler() {
this.downCallback()
},
deep: true
}
},
created() {
//
getCooperationList({ pageNum: 1, pageSize: 1000 }).then((res) => {
if (res) {
this.customerList = this.customerList.concat(res.records)
}
})
}
}
</script>
<style lang="scss" scoped>
.content {
width: 750rpx;
display: flex;
flex-direction: column;
justify-content: flex-start;
align-items: stretch;
.condition-area {
width: 750rpx;
height: 80rpx;
padding: 0 32rpx 0 12rpx;
margin-bottom: 20rpx;
background-color: #fff;
}
}
.contract-item {
width: 750rpx;
background-color: #fff;
margin-bottom: 20rpx;
position: relative;
.header {
width: 750rpx;
padding: 24rpx 32rpx;
.icon {
top: 0;
right: 0;
position: absolute;
width: 160rpx;
height: 50rpx;
border-radius: 0 0 0 20rpx;
display: flex;
flex-direction: row;
justify-content: center;
align-items: center;
}
.icon__ORDER_CONTRACT {
background-color: #e28686;
}
.icon__GUARANTEE_CONTRACT {
background-color: #86e2df;
}
.title {
font-size: 32rpx;
color: #003a8c;
font-weight: 600;
margin-bottom: 28rpx;
}
.row {
margin-top: 24rpx;
.label {
font-size: 28rpx;
color: #888888;
margin-right: 24rpx;
}
.value {
font-size: 28rpx;
color: #333333;
}
}
}
.footer {
width: 750rpx;
padding: 24rpx 32rpx;
border-top: 1px solid rgba(221, 221, 221, 0.5);
}
}
</style>

337
pages/enquiry-list/index.vue

@ -0,0 +1,337 @@
<template>
<view class="wrapper">
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="询价列表"></uni-nav-bar>
<view>
<view class="status-bar">
<view v-for="(item, index) in statusBarArray" :key="index" :class="{ box: true, 'box--selected': current == index }" @click="selectStatus(item, index)">
{{ item }}
</view>
</view>
<scroll-list ref="list" :option="option" @load="upCallback" @refresh="downCallback">
<view class="content" v-for="(item, index) in list" :key="index">
<view class="header">
<view class="header-title">{{ item.id }}</view>
<view class="header-value">
<text :class="item.status == 30131 || item.status == 30138 ? 'failure' : ''">{{ item.status | statusName }}</text>
</view>
</view>
<view class="box" v-if="item.status != 30116 && item.status != 30131">
<view class="list-box" v-for="(subItem, subIndex) in item.itemList" :key="subIndex">
<image
class="image"
:src="subItem.productImg || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'"
mode=""
></image>
<view class="info-box">
<view class="name">{{ subItem.paperName }}</view>
<view class="value">
{{ subItem.brandName }}/{{ subItem.categoryName }}/{{ subItem.gramWeight }}g/{{ subItem.width }}*{{ subItem.length }}/{{ subItem.quantity }}
</view>
</view>
</view>
</view>
<view class="box" v-else>
<view class="list-box" v-for="(subItem, subIndex) in item.reply.replyItemList" :key="subIndex">
<image
class="image"
:src="subItem.productImg || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'"
mode=""
></image>
<view class="info-box">
<view class="name">{{ subItem.paperName }}</view>
<view class="value">
{{ subItem.brandName }}/{{ subItem.categoryName }}/{{ subItem.gramWeight }}g/{{ subItem.width }}*{{ subItem.length }}/{{ subItem.quantity }}
</view>
</view>
</view>
</view>
<view class="other" v-if="item.status == 30116 || item.status == 30131">
<view class="left">{{ item.createTime }}</view>
<view class="right">
<view>
<text class="price" v-if="item.reply">¥ {{ item.reply.totalPrice }}</text>
</view>
<view class="btn" @tap="placeOrderTap(item, item.reply.replyItemList)" v-if="item.status == 30116">去下单</view>
</view>
</view>
</view>
</scroll-list>
</view>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
import { getEnquiryOrder, createByEnquiry } from '@/apis/enquiryListApi.js'
export default {
data() {
return {
current: 0,
statusBarArray: ['全部', '待报价', '已报价', '已成交'],
option: {
size: 10,
auto: true,
emptyText: '暂无数据~',
background: '#F7F8FA',
disabled: false,
emptyImage: '/static/imgs/order/order-empty.png'
},
pagination: {
status: 0,
pageNum: 0, //
pageSize: 10
},
list: []
}
},
filters: {
statusName(e) {
let name = ''
switch (e) {
case 30114:
name = '待报价'
break
case 30116:
name = '已报价'
break
case 30131:
name = '已成交'
break
case 30138:
name = '已失效'
break
default:
break
}
return name
}
},
onShow() {
this.downCallback()
},
methods: {
go2,
back,
selectStatus(item, index) {
this.current = index
this.pagination.status = index
this.downCallback()
},
getList() {
return new Promise((resolve, reject) => {
getEnquiryOrder({ ...this.pagination })
.then((res) => {
// console.log('', res.records)
if (res) {
if (res.current == 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.pagination.pageNum = 1
this.getList()
.then(({ list, total }) => {
this.$refs.list.refreshSuccess({ list, total })
})
.catch(() => {
this.$refs.list.refreshFail()
})
},
upCallback() {
this.pagination.pageNum++
this.getList()
.then(({ list, total }) => {
this.$refs.list.loadSuccess({ list, total })
})
.catch(() => {
this.$refs.list.loadFail()
})
},
//
placeOrderTap(item, replyItemList) {
let supplierOtherFee = replyItemList.map((replyItem) => {
return {
mallSupplierId: replyItem.mallSupplierId,
otherFee: replyItem.otherFee
}
})
const params = {
enquiryId: item.id,
orderGoodsList: replyItemList,
purchaserEnterpriseId: this.$store.state.companyInfo.id,
userId: this.$store.state.userInfo.userId,
supplierOtherFee
}
createByEnquiry(params).then((res) => {
if (res) {
uni.showToast({
title: '下单成功',
icon: 'success'
})
setTimeout(() => {
go2('order-make', { orderId: res.orderId })
}, 500)
}
})
}
}
}
</script>
<style lang="scss" scoped>
.wrapper {
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 rgba(221,221,221,0.5);
background-color: #fff;
border-bottom: 2rpx solid rgba($color: #dddddd, $alpha: 0.8);
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;
}
}
.content {
margin-top: 20rpx;
.header {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
height: 88rpx;
background: #ffffff;
padding: 0rpx 32rpx;
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
.header-title {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
font-weight: 500;
}
.header-value {
font-size: 30rpx;
color: #ff5368;
letter-spacing: 0;
text-align: right;
font-weight: 500;
.failure {
color: #888888;
}
}
}
.box {
background-color: #fff;
padding: 24rpx 32rpx;
.list-box:nth-last-child(even) {
border-bottom: 2rpx solid rgba(221, 221, 221, 0.5);
}
.list-box {
display: flex;
flex-direction: row;
// height: 148rpx;
background: #ffffff;
// padding: 24rpx 0rpx;
.image {
width: 100rpx;
height: 100rpx;
flex: 0 0 100rpx;
margin-right: 20rpx;
}
.info-box {
.name {
font-size: 30rpx;
color: #333333;
letter-spacing: 0;
text-align: left;
font-weight: 400;
padding-top: 4rpx;
}
.value {
font-size: 26rpx;
color: #888888;
letter-spacing: 0;
text-align: left;
font-weight: 400;
padding-top: 26rpx;
}
}
}
}
.other {
display: flex;
flex-direction: row;
justify-content: space-between;
align-items: center;
padding: 0rpx 32rpx;
height: 80rpx;
background: #ffffff;
border-top: 2rpx solid rgba(221, 221, 221, 0.5);
.left {
font-size: 26rpx;
color: #888888;
letter-spacing: 0;
text-align: left;
font-weight: 400;
}
.right {
display: flex;
align-items: center;
.price {
font-size: 30rpx;
color: #ff5368;
letter-spacing: 0;
text-align: right;
font-weight: 500;
}
.btn {
margin-left: 24rpx;
width: 132rpx;
height: 54rpx;
line-height: 54rpx;
background: #007aff;
border-radius: 27rpx;
font-size: 28rpx;
color: #ffffff;
letter-spacing: 0;
text-align: center;
font-weight: 500;
}
}
}
}
}
</style>

7
pages/mall/index.vue

@ -30,7 +30,12 @@
</view> </view>
</view> </view>
<view class="bottom-group_1 flex-row"> <view class="bottom-group_1 flex-row">
<view class="paper-group flex-col" v-for="paper in item.skuList" :key="paper.id">
<view
class="paper-group flex-col"
v-for="paper in item.skuList"
:key="paper.productSkuId"
@click="go2('paper-details', { paperId: paper.productSkuId })"
>
<view class="top-group flex-col items-center"> <view class="top-group flex-col items-center">
<image :src="paper.litPicUrl || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'" class="image_4" /> <image :src="paper.litPicUrl || 'https://qncloud.oss-cn-shenzhen.aliyuncs.com/paper_shopkeeper/paper-default-small.png'" class="image_4" />
<view class="flex-col text-wrapper"> <view class="flex-col text-wrapper">

8
pages/mine/index.vue

@ -73,7 +73,7 @@
<image class="icon" src="/static/imgs/mine/enquiry-icon.png"></image> <image class="icon" src="/static/imgs/mine/enquiry-icon.png"></image>
<text class="label">询价结果</text> <text class="label">询价结果</text>
</view> </view>
<view class="icon-item" @click="loginGo2('enquiry-list')">
<view class="icon-item" @click="loginGo2('contract-manage')">
<image class="icon" src="/static/imgs/mine/contract-icon.png"></image> <image class="icon" src="/static/imgs/mine/contract-icon.png"></image>
<text class="label">合同管理</text> <text class="label">合同管理</text>
</view> </view>
@ -81,9 +81,13 @@
<image class="icon" src="/static/imgs/mine/certification-icon.png"></image> <image class="icon" src="/static/imgs/mine/certification-icon.png"></image>
<text class="label">验厂申请</text> <text class="label">验厂申请</text>
</view> </view>
<view class="icon-item" @click="loginGo2('address-manage')">
<!-- <view class="icon-item" @click="loginGo2('address-manage')">
<image class="icon" src="/static/imgs/mine/enterprise-icon.png"></image> <image class="icon" src="/static/imgs/mine/enterprise-icon.png"></image>
<text class="label">我的企业</text> <text class="label">我的企业</text>
</view> -->
<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> </view>
</view> </view>

4
pages/page-view/index.vue

@ -48,12 +48,12 @@ export default {
go2('fs-credit', { ...this.params }, true) go2('fs-credit', { ...this.params }, true)
} }
// //
if (data.type == 'zzgSupplierTCSignSuccess') {
if (data.type == 'ybkClientTCSignSuccess') {
go2('order-detail', { orderId: data.data.orderId }, true) go2('order-detail', { orderId: data.data.orderId }, true)
} }
// //
if (data.type == 'signSuccess') { if (data.type == 'signSuccess') {
// go2('paper-mall-order-detail', { id: data.orderId }, true)
// go2('order-detail', { id: data.orderId }, true)
} }
// //
if (data.type == 'certificatedSuccess') { if (data.type == 'certificatedSuccess') {

5
pages/paper-details/index.vue

@ -156,8 +156,8 @@ const validateFields = [
label: '纸品克重' label: '纸品克重'
}, },
{ {
value: 'pieceQuantity',
label: '购买量'
value: 'buyTon',
label: '购买量'
} }
] ]
export default { export default {
@ -263,7 +263,6 @@ export default {
// //
queryData() { queryData() {
getPaperDetail(this.params).then((res) => { getPaperDetail(this.params).then((res) => {
console.log('店铺纸品详情', res)
if (res) { if (res) {
this.info = res this.info = res
if (!this.info.imgList || this.info.imgList.length == 0) { if (!this.info.imgList || this.info.imgList.length == 0) {

BIN
static/imgs/.DS_Store

1
utils/hook.js

@ -169,6 +169,7 @@ export function uploadVideo(sourceType = ['album', 'camera'], compressed = true)
maxDuration: 30, maxDuration: 30,
success: (res) => { success: (res) => {
const tempFilePath = res.tempFilePath const tempFilePath = res.tempFilePath
console.log('video size:', res, res.size)
if (res.size && res.size > 1024 * 1024 * 10) { if (res.size && res.size > 1024 * 1024 * 10) {
reject('视频大小不能超过10M') reject('视频大小不能超过10M')
} else { } else {

Loading…
Cancel
Save