Browse Source

no message

devlop
xpz2018 3 years ago
parent
commit
6230a07855
13 changed files with 1178 additions and 178 deletions
  1. 10
      apis/factoryApi.js
  2. 13
      apis/orderApi.js
  3. 264
      components/countdown/countdown.vue
  4. 27
      components/uni-status-bar/uni-status-bar.vue
  5. 4
      components/uni-steps/uni-steps.vue
  6. 43
      enums/index.js
  7. 8
      pages.json
  8. 47
      pages/digital-workshops/DeviceItem.vue
  9. 278
      pages/digital-workshops/OrderItem.vue
  10. 532
      pages/digital-workshops/index.vue
  11. 2
      pages/factory/index.vue
  12. 128
      pages/order-info/index.vue
  13. BIN
      static/imgs/cart/icon-time.png

10
apis/factoryApi.js

@ -83,3 +83,13 @@ export function getMyFactoryList(data = {}) {
data data
}) })
} }
/**
* 获取我的工厂列表
*/
export function getMachinList(data = {}) {
return http.get({
url: `/cloud-print-cloud-factory/user/get/factory/machine/list`,
data
})
}

13
apis/orderApi.js

@ -172,3 +172,16 @@ export function makeSupplierPay(data) {
data data
}) })
} }
export const getProdOrderList = (data) => {
return http.get({
url: '/cloud-print-cloud-factory/get/my-enterprise/purchasing-order-list/by-supplier',
data
})
}
export const getProdOrderInfo = (id) => {
return http.get({
url: `/cloud-print-cloud-factory/get/my-enterprise/purchasing-order/${id}`
})
}

264
components/countdown/countdown.vue

@ -0,0 +1,264 @@
<template>
<view class="uni-countdown">
<text v-if="showDay" :style="[timeStyle]" class="uni-countdown__number">{{ d }}</text>
<text v-if="showDay" :style="[splitorStyle]" class="uni-countdown__splitor">{{dayText}}</text>
<text :style="[timeStyle]" class="uni-countdown__number">{{ h }}</text>
<text :style="[splitorStyle]" class="uni-countdown__splitor">{{ showColon ? ':' : hourText }}</text>
<text :style="[timeStyle]" class="uni-countdown__number">{{ i }}</text>
<text :style="[splitorStyle]" class="uni-countdown__splitor">{{ showColon ? ':' : minuteText }}</text>
<text :style="[timeStyle]" class="uni-countdown__number">{{ s }}</text>
<text v-if="!showColon" :style="[splitorStyle]" class="uni-countdown__splitor">{{secondText}}</text>
</view>
</template>
<script>
/**
* Countdown 倒计时
* @description 倒计时组件
* @tutorial https://ext.dcloud.net.cn/plugin?id=25
* @property {String} backgroundColor 背景色
* @property {String} color 文字颜色
* @property {Number} day 天数
* @property {Number} hour 小时
* @property {Number} minute 分钟
* @property {Number} second
* @property {Number} timestamp 时间戳
* @property {Boolean} showDay = [true|false] 是否显示天数
* @property {Boolean} show-colon = [true|false] 是否以冒号为分隔符
* @property {String} splitorColor 分割符号颜色
* @event {Function} timeup 倒计时时间到触发事件
* @example <uni-countdown :day="1" :hour="1" :minute="12" :second="40"></uni-countdown>
*/
export default {
name: 'UniCountdown',
emits: ['timeup'],
props: {
showDay: {
type: Boolean,
default: true
},
showColon: {
type: Boolean,
default: false
},
start: {
type: Boolean,
default: true
},
backgroundColor: {
type: String,
default: ''
},
color: {
type: String,
default: '#333'
},
fontSize: {
type: Number,
default: 14
},
splitorColor: {
type: String,
default: '#333'
},
day: {
type: Number,
default: 0
},
hour: {
type: Number,
default: 0
},
minute: {
type: Number,
default: 0
},
second: {
type: Number,
default: 0
},
timestamp: {
type: Number,
default: 0
}
},
data() {
return {
timer: null,
syncFlag: false,
d: '00',
h: '00',
i: '00',
s: '00',
leftTime: 0,
seconds: 0
}
},
computed: {
dayText() {
return '天'
},
hourText(val) {
return '时'
},
minuteText(val) {
return '分'
},
secondText(val) {
return '秒'
},
timeStyle() {
const {
color,
backgroundColor,
fontSize
} = this
return {
color,
backgroundColor,
fontSize: `${fontSize}px`,
width: `${fontSize * 22 / 14}px`, // 14px
lineHeight: `${fontSize * 20 / 14}px`,
borderRadius: `${fontSize * 3 / 14}px`,
}
},
splitorStyle() {
const { splitorColor, fontSize, backgroundColor } = this
return {
color: splitorColor,
fontSize: `${fontSize * 12 / 14}px`,
margin: backgroundColor ? `${fontSize * 4 / 14}px` : ''
}
}
},
watch: {
day(val) {
this.changeFlag()
},
hour(val) {
this.changeFlag()
},
minute(val) {
this.changeFlag()
},
second(val) {
this.changeFlag()
},
start: {
immediate: true,
handler(newVal, oldVal) {
if (newVal) {
this.startData();
} else {
if (!oldVal) return
clearInterval(this.timer)
}
}
}
},
created: function(e) {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
this.countDown()
},
// #ifndef VUE3
destroyed() {
clearInterval(this.timer)
},
// #endif
// #ifdef VUE3
unmounted() {
clearInterval(this.timer)
},
// #endif
methods: {
toSeconds(timestamp, day, hours, minutes, seconds) {
if (timestamp) {
return timestamp - parseInt(new Date().getTime() / 1000, 10)
}
return day * 60 * 60 * 24 + hours * 60 * 60 + minutes * 60 + seconds
},
timeUp() {
clearInterval(this.timer)
this.$emit('timeup')
},
countDown() {
let seconds = this.seconds
let [day, hour, minute, second] = [0, 0, 0, 0]
if (seconds > 0) {
day = Math.floor(seconds / (60 * 60 * 24))
hour = Math.floor(seconds / (60 * 60)) - (day * 24)
minute = Math.floor(seconds / 60) - (day * 24 * 60) - (hour * 60)
second = Math.floor(seconds) - (day * 24 * 60 * 60) - (hour * 60 * 60) - (minute * 60)
} else {
this.timeUp()
}
if (day < 10) {
day = '0' + day
}
if (hour < 10) {
hour = '0' + hour
}
if (minute < 10) {
minute = '0' + minute
}
if (second < 10) {
second = '0' + second
}
this.d = day
this.h = hour
this.i = minute
this.s = second
},
startData() {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
if (this.seconds <= 0) {
this.seconds = this.toSeconds(0, 0, 0, 0, 0)
this.countDown()
return
}
clearInterval(this.timer)
this.countDown()
this.timer = setInterval(() => {
this.seconds--
if (this.seconds < 0) {
this.timeUp()
return
}
this.countDown()
}, 1000)
},
update(){
this.startData();
},
changeFlag() {
if (!this.syncFlag) {
this.seconds = this.toSeconds(this.timestamp, this.day, this.hour, this.minute, this.second)
this.startData();
this.syncFlag = true;
}
}
}
}
</script>
<style lang="scss" scoped>
$font-size: 14px;
.uni-countdown {
display: flex;
flex-direction: row;
justify-content: flex-start;
align-items: center;
&__splitor {
margin: 0 2px;
font-size: $font-size;
color: #333;
}
&__number {
border-radius: 3px;
text-align: center;
font-size: $font-size;
}
}
</style>

27
components/uni-status-bar/uni-status-bar.vue

@ -0,0 +1,27 @@
<template>
<view :style="{ height: statusBarHeight }" class="uni-status-bar">
<slot />
</view>
</template>
<script>
export default {
name: 'UniStatusBar',
data() {
return {
statusBarHeight: 20
}
},
mounted() {
this.statusBarHeight = uni.getSystemInfoSync().statusBarHeight + 'px'
}
}
</script>
<style lang="scss" scoped>
.uni-status-bar {
// width: 750rpx;
height: 20px;
// height: var(--status-bar-height);
}
</style>

4
components/uni-steps/uni-steps.vue

@ -137,9 +137,7 @@ export default {
.uni-steps__column-text { .uni-steps__column-text {
padding: 6px 0px; padding: 6px 0px;
border-bottom-style: solid;
border-bottom-width: 1px;
border-bottom-color: $uni-border-color;
min-height: 100rpx;
/* #ifndef APP-NVUE */ /* #ifndef APP-NVUE */
display: flex; display: flex;
/* #endif */ /* #endif */

43
enums/index.js

@ -38,11 +38,11 @@ export const enterpriseType = {
} }
/** /**
* 设备状态: 空闲中 1 工作中 2
* 设备状态: 空闲中 0 工作中 1
*/ */
export const deviceStatus = { export const deviceStatus = {
FREE: 1,
WORKING: 2
FREE: 0,
WORKING: 1
} }
/** /**
* 账号类型 * 账号类型
@ -353,3 +353,40 @@ export const applyingTypeEnum = {
REJECT: 3, REJECT: 3,
EXPIRED: 4 EXPIRED: 4
} }
// 状态。-1:待提交,4:生产中,1:已发货,3:已完成
export const StatusEnum = {
ALL: -2,
WAIT_CONFIRM: -1,
WAIT_SUPPLIER_CONFIRM: 4,
ORDERED: 1,
FINISHED: 3
}
export const StatusMap = {
[StatusEnum.ALL]: '全部',
[StatusEnum.WAIT_CONFIRM]: '待排产',
[StatusEnum.WAIT_SUPPLIER_CONFIRM]: '生产中',
[StatusEnum.ORDERED]: '已发货',
[StatusEnum.FINISHED]: '已完成'
}
// 状态。-1:待提交,4:生产中,1:已发货,2:已完成
export const orderStatusList = [
{
value: StatusEnum.ALL,
label: '全部'
},
{
value: StatusEnum.WAIT_CONFIRM,
label: '待排产'
},
{
value: StatusEnum.WAIT_SUPPLIER_CONFIRM,
label: '生产中'
},
{
value: StatusEnum.FINISHED,
label: '已完成'
}
]

8
pages.json

@ -235,6 +235,14 @@
"navigationStyle": "custom" "navigationStyle": "custom"
} }
}, },
{
"path": "pages/order-info/index",
"style": {
"navigationBarTitleText": "订单详情",
"enablePullDownRefresh": true,
"navigationStyle": "custom"
}
},
{ {
"path": "pages/apply-detail/index", "path": "pages/apply-detail/index",
"style": { "style": {

47
pages/digital-workshops/DeviceItem.vue

@ -1,15 +1,22 @@
<template> <template>
<view class="list-item flex-row" @click="emit"> <view class="list-item flex-row" @click="emit">
<view class="left-section_2 flex-col items-start"> <view class="left-section_2 flex-col items-start">
<image class="avatar" :src="deviceInfo.machineImg || '/static/imgs/general/device-default.png'"></image>
<view v-if="hasCloudBox"> <view v-if="hasCloudBox">
<view class="text-wrapper_3 flex-col" v-show="deviceInfo.status == deviceStatus.WORKING">
<view class="text-wrapper_3 flex-col" v-show="deviceInfo.workingStatus == deviceStatus.WORKING">
<text class="text_21">生产中</text> <text class="text_21">生产中</text>
</view> </view>
<view class="text-wrapper_3 flex-col items-center view_16" v-show="deviceInfo.status == deviceStatus.FREE">
<view class="text-wrapper_3 flex-col items-center view_16" v-show="deviceInfo.workingStatus == deviceStatus.FREE">
<text class="text_21">空闲</text> <text class="text_21">空闲</text>
</view> </view>
</view> </view>
<image class="avatar" :src="deviceInfo.licPicUrl || '/static/imgs/general/device-default.png'"></image>
<view class="text-wrapper_4 flex-col">
<text class="text_21">{{ deviceInfo.typeName }}</text>
</view>
<!-- <view style="position: relative;">
<image class="avatar" :src="deviceInfo.machineImg || '/static/imgs/general/device-default.png'"></image>
</view> -->
<!-- <image class="avatar" :src="deviceInfo.machineImg || '/static/imgs/general/device-default.png'"></image> -->
</view> </view>
<view class="right-group flex-col"> <view class="right-group flex-col">
<view class="top-group justify-between"> <view class="top-group justify-between">
@ -69,10 +76,10 @@ export default {
}, },
computed: { computed: {
hasCloudBox() { hasCloudBox() {
return this.deviceInfo.cloudBoxId || false
return this.deviceInfo.hasCloudBox || false
}, },
hasCamera() { hasCamera() {
return this.deviceInfo.cameraId || false
return this.deviceInfo.hlsUrl || false
} }
}, },
methods: { methods: {
@ -111,7 +118,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.list-item { .list-item {
padding: 20rpx 20rpx 20rpx 20rpx; padding: 20rpx 20rpx 20rpx 20rpx;
background-color: rgba(237, 236, 252, 0.5);
background-color: white;
border-radius: 16rpx; border-radius: 16rpx;
&:last-of-type { &:last-of-type {
margin-top: 20rpx; margin-top: 20rpx;
@ -139,7 +146,31 @@ export default {
margin-right: 7rpx; margin-right: 7rpx;
} }
} }
.view_16 {
.text-wrapper_4 {
position: absolute;
bottom: 0;
left: 0;
padding: 4rpx;
background-color: #cccccc88;
border-radius: 0rpx 8px 0rpx 15rpx;
.text_21 {
margin-left: 6rpx;
margin-right: 7rpx;
}
}
.text-wrapper_3 {
position: absolute;
top: 0;
left: 0;
padding-top: 4rpx;
background-color: rgb(82, 196, 26);
border-radius: 15rpx 0px 15rpx 0px;
.text_21 {
margin-left: 6rpx;
margin-right: 7rpx;
}
} .view_16 {
padding-top: initial; padding-top: initial;
background-color: rgb(255, 72, 73); background-color: rgb(255, 72, 73);
padding: 3rpx 0 2rpx; padding: 3rpx 0 2rpx;
@ -154,7 +185,7 @@ export default {
margin-left: 5rpx; margin-left: 5rpx;
flex: 1 1 auto; flex: 1 1 auto;
.top-group { .top-group {
padding: 0 26rpx;
padding: 0 0 0 26rpx;
color: rgb(0, 0, 0); color: rgb(0, 0, 0);
font-size: 30rpx; font-size: 30rpx;
font-weight: 500; font-weight: 500;

278
pages/digital-workshops/OrderItem.vue

@ -0,0 +1,278 @@
<template>
<view style="padding: 0rpx 24rpx;">
<view class="list-item flex-col" @click="emit">
<view class="flex-row-center-space" style="height: 72rpx;font-size: 28rpx;">
<view class="flex-row-center-center">
<image src="/static/imgs/tabbar/mine-gray.png" style="width: 48rpx;height: 48rpx;"/>
<view style="margin-left: 8rpx;font-size: 28rpx;">{{item.customerEnterpriseName}}</view>
</view>
<view :style="{ color: statusColor(item.status) }">{{orderStatusMap[item.status]}}</view>
</view>
<view class="flex-row" style="padding: 16rpx 0rpx;border-top: 1rpx solid #f3f3f3;" v-if="item.productInfoList && item.productInfoList.length">
<image style="height: 160rpx;width: 160rpx;" :src="item.productInfoList[0].img"></image>
<view class="flex-col" style="margin-left: 16rpx;flex: 1;">
<view class="flex-row-center-space">
<view style="font-size: 30rpx;">{{item.productInfoList[0].productName}}</view>
<view style="font-size: 28rpx;">{{item.productInfoList[0].quantity}} {{item.productInfoList[0].unit || '个'}}</view>
</view>
<view style="font-size: 24rpx;color: #cccccc;margin-top: 16rpx;">尺寸{{item.productInfoList[0].trimmedSize}}</view>
<view style="font-size: 24rpx;color: #cccccc;margin-top: 4rpx;">材质{{item.productInfoList[0].materialsRequirement}}</view>
<view class="flex-row-center-start" style="margin-top: 24rpx;">
<image src="/static/imgs/cart/icon-time.png" style="width: 40rpx;height: 40rpx;"/>
<view style="font-size: 28rpx;color: #cccccc;">缴费日期{{item.deliveryDate}}</view>
</view>
</view>
</view>
</view>
</view>
</template>
#f3f3f3
<script>
import { StatusMap } from '@/enums/index'
export default {
props: {
item: {
type: Object,
default: () => ({})
}
},
data() {
return {
orderStatusMap: Object.freeze(StatusMap)
}
},
methods: {
emit() {
this.$emit('click', this.item)
},
statusColor(status){
if(status == 3){
return '#028A00'
}
if(status == 4){
return '#007AFF'
}
return '#999999'
},
translate(time) {
if (!time) {
return ''
}
time = time.replace(/-/g, '/')
let date = new Date(time)
let month = date.getMonth() + 1
let day = date.getDate()
let hour = date.getHours()
let minute = date.getMinutes()
if (minute < 10) {
minute = '0' + minute
}
return `最近开机 ${month}${day}${hour}:${minute}`
}
},
filters: {
translateRate(rate) {
if (!rate) {
rate = 0
} else {
rate = rate.toFixed(2)
}
return rate
}
}
}
</script>
<style lang="scss" scoped>
.list-item {
padding: 0rpx 20rpx;
background-color: white;
border-radius: 16rpx;
&:last-of-type {
margin-top: 20rpx;
}
.left-section_2 {
color: rgb(255, 255, 255);
font-size: 20rpx;
font-weight: 500;
line-height: 28rpx;
white-space: nowrap;
border-radius: 15rpx;
width: 180rpx;
height: 180rpx;
position: relative;
overflow: hidden;
.text-wrapper_3 {
position: absolute;
top: 0;
left: 0;
padding-top: 4rpx;
background-color: rgb(82, 196, 26);
border-radius: 15rpx 0px 15rpx 0px;
.text_21 {
margin-left: 6rpx;
margin-right: 7rpx;
}
}
.text-wrapper_4 {
position: absolute;
bottom: 0;
left: 0;
padding: 4rpx;
background-color: #cccccc88;
border-radius: 0rpx 8px 0rpx 15rpx;
.text_21 {
margin-left: 6rpx;
margin-right: 7rpx;
}
}
.text-wrapper_3 {
position: absolute;
top: 0;
left: 0;
padding-top: 4rpx;
background-color: rgb(82, 196, 26);
border-radius: 15rpx 0px 15rpx 0px;
.text_21 {
margin-left: 6rpx;
margin-right: 7rpx;
}
} .view_16 {
padding-top: initial;
background-color: rgb(255, 72, 73);
padding: 3rpx 0 2rpx;
width: 73rpx;
}
.avatar {
width: 100%;
height: 100%;
}
}
.right-group {
margin-left: 5rpx;
flex: 1 1 auto;
.top-group {
padding: 0 0 0 26rpx;
color: rgb(0, 0, 0);
font-size: 30rpx;
font-weight: 500;
line-height: 42rpx;
white-space: nowrap;
align-items: center;
.name {
max-width: 360rpx;
}
.image_5 {
margin-left: 8rpx;
width: 24rpx;
height: 24rpx;
}
}
.equal-division {
margin-left: 26rpx;
.equal-division-item {
padding: 10rpx 0;
flex: 1 1 146rpx;
.text_24 {
color: rgb(24, 16, 89);
font-size: 22rpx;
line-height: 30rpx;
white-space: nowrap;
}
.bottom-group_1 {
margin-top: 4rpx;
.text_26 {
color: rgb(24, 16, 89);
font-size: 32rpx;
font-weight: 500;
line-height: 45rpx;
white-space: nowrap;
}
.text_28 {
margin: 8rpx 0 6rpx 10rpx;
color: rgb(24, 16, 89);
font-size: 22rpx;
line-height: 30rpx;
white-space: nowrap;
}
}
}
.equal-division-item_1 {
padding: 10rpx 23rpx 10rpx 36rpx;
flex: 1 1 146rpx;
.text_30 {
color: rgb(24, 16, 89);
font-size: 22rpx;
line-height: 30rpx;
white-space: nowrap;
}
.bottom-group_2 {
margin-top: 4rpx;
.text_32 {
color: rgb(24, 16, 89);
font-size: 32rpx;
font-weight: 500;
line-height: 45rpx;
white-space: nowrap;
}
.text_34 {
margin: 8rpx 0 6rpx 10rpx;
color: rgb(24, 16, 89);
font-size: 22rpx;
line-height: 30rpx;
white-space: nowrap;
}
}
}
.equal-division-item_2 {
padding: 10rpx 24rpx 10rpx 26rpx;
flex: 1 1 146rpx;
.text_36 {
color: rgb(24, 16, 89);
font-size: 22rpx;
line-height: 30rpx;
white-space: nowrap;
}
.bottom-group_3 {
margin-top: 4rpx;
.text_38 {
color: rgb(24, 16, 89);
font-size: 32rpx;
font-weight: 500;
line-height: 45rpx;
white-space: nowrap;
}
.text_40 {
margin: 8rpx 0 6rpx 10rpx;
color: rgb(24, 16, 89);
font-size: 22rpx;
line-height: 30rpx;
white-space: nowrap;
}
}
}
}
.bottom-group_4 {
margin-top: 14rpx;
padding: 0 26rpx;
color: rgb(136, 136, 136);
font-size: 20rpx;
line-height: 28rpx;
white-space: nowrap;
.text_43 {
margin-left: 11rpx;
}
}
}
.text_59 {
margin-top: 23rpx;
padding-left: 26rpx;
color: rgb(24, 16, 89);
font-size: 26rpx;
font-weight: 500;
line-height: 37rpx;
white-space: nowrap;
}
}
</style>

532
pages/digital-workshops/index.vue

@ -1,110 +1,126 @@
<template> <template>
<view>
<view class="content">
<view class="flex-col group">
<view class="flex-col section_1">
<view class="justify-between section_2">
<view class="select-area">
<qn-select options-align="left" :contentStyle="contentStyle" :options="factoryList" v-model="factoryId" placeholder="请选择工厂" hasOperation>
<template #operation>
<view class="operation" @click.stop="manageFactory">
<text>工厂管理</text>
<image class="icon" src="/static/imgs/digital-workshops/operation-icon.png"></image>
</view>
</template>
</qn-select>
</view>
<text v-show="!isExample" class="text_1" @click="go2('promotion', { id: factoryId, operation: isExample ? 'info' : 'edit' })">推广</text>
</view>
</view>
<view class="flex-col">
<view class="flex-col section_3">
<view class="flex-row group_2">
<view
class="text-wrapper"
:class="{ 'text-wrapper_selected': curTab === key }"
v-for="(value, key) in listObj"
:key="key"
@click="selectTab(key)"
>
<text v-if="key != 'null'">{{ key }}</text>
<view v-show="curTab === key" class="divider"></view>
</view>
</view>
</view>
<view class="bottom-group flex-col">
<view class="flex-row section_5">
<view class="flex-row group_3" v-for="(value, key) in listObj[curTab].type" :key="key">
<view class="group_4">
<text class="text_5">{{ key }}(</text>
<text class="text_7">{{ value[0] }}</text>
<text class="text_5">/</text>
<text class="text_11">{{ value[1] }}</text>
<text class="text_5">)</text>
</view>
</view>
<view v-if="!listObj['所有设备'].list || listObj['所有设备'].list.length == 0" class="flex-row-center-center empty_1">
<text>设备列表为空</text>
</view>
</view>
<view class="flex-col section_8" v-if="cameraList && cameraList.length > 0">
<view class="justify-between group_11">
<text>摄像机({{ cameraList.length }})</text>
<image src="/static/imgs/digital-workshops/right-arrow-icon.png" class="image_1" @click="go2('camera-list', { id: factoryId })" />
</view>
<view class="flex-col items-center group_12">
<image src="/static/imgs/digital-workshops/camera-tip-bg.png" class="image_2" @click="go2('video-play', { url: cameraList[0].videoUrl })" />
<text class="text_18">{{ cameraList[0].address }}</text>
</view>
</view>
<view class="flex-col section_9">
<view class="justify-between sticky">
<text class="text_19">设备列表</text>
<view class="flex-row group_14" v-if="!isExample" @click="addDevice">
<text>新增</text>
<image src="/static/imgs/digital-workshops/add-icon.png" class="image_4" />
</view>
</view>
<view class="list-area">
<view v-if="listObj[curTab].list && listObj[curTab].list.length > 0">
<DeviceItem v-for="item in listObj[curTab].list" :key="item.id" :deviceInfo="item" style="margin-bottom: 20rpx" @click="jump"></DeviceItem>
</view>
<view v-else>
<view class="flex-col group_9">
<view class="flex-col items-center group_10">
<view class="flex-col items-center image-wrapper">
<image src="/static/imgs/digital-workshops/empty-list.png" class="image_5" />
</view>
<text class="text_10">设备列表为空</text>
</view>
<view class="flex-col items-center text-wrapper_4" @click="addDevice">
<text>添加设备</text>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
</view>
<view class="content">
<view class="navbar--fixed" style="background-color: white;">
<uni-status-bar></uni-status-bar>
<view style="display: flex;width: 750rpx;height: 44px;align-items: center;justify-content: space-between;padding: 0rpx 24rpx;">
<view class="select-area">
<qn-select options-align="left" :contentStyle="contentStyle" :options="factoryList" v-model="factoryId" placeholder="请选择工厂" hasOperation>
<template #operation>
<view class="operation" @click.stop="manageFactory">
<text>工厂管理</text>
<image class="icon" src="/static/imgs/digital-workshops/operation-icon.png"></image>
</view>
</template>
</qn-select>
</view>
<view style="width: 240rpx;">
<uni-segmented-control :current="current" :values="['设备', '订单']" @clickItem="onClickItem" styleType="button"></uni-segmented-control>
</view>
</view>
</view>
<view class="uni-navbar__placeholder">
<uni-status-bar></uni-status-bar>
<view style="height: 44px" />
</view>
<view class="flex-col" style="flex-grow: 1;overflow: hidden;" v-show="current == 0">
<view class="flex-col section_3">
<view class="flex-row group_2" style="flex: 1;">
<view class="text-wrapper" :class="{ 'text-wrapper_selected': curTab === key }" v-for="(value, key) in listObj" :key="key" @click="selectTab(key)">
<text v-if="key != 'null'">{{ key }}</text>
<view v-show="curTab === key" class="divider"></view>
</view>
<!-- <view style="display: flex;align-items: center;justify-content:flex-end;flex: 1;">
<uni-icons type="plusempty" size="28" @click="addDevice"></uni-icons>
</view> -->
</view>
</view>
<view class="bottom-group flex-col">
<view class="flex-row section_5">
<view class="flex-row group_3" v-for="(value, key) in listObj[curTab].type" :key="key">
<view class="group_4">
<text class="text_5">{{ key }}(</text>
<text class="text_7">{{ value[0] }}</text>
<!-- <text class="text_5">/</text>
<text class="text_11">{{ value[1] }}</text> -->
<text class="text_5">)</text>
</view>
</view>
<view v-if="!listObj['所有设备'].list || listObj['所有设备'].list.length == 0" class="flex-row-center-center empty_1">
<text>设备列表为空</text>
</view>
</view>
<view class="flex-col section_8" v-if="cameraList && cameraList.length > 0">
<view class="justify-between group_11">
<text>摄像机({{ cameraList.length }})</text>
<image src="/static/imgs/digital-workshops/right-arrow-icon.png" class="image_1" @click="go2('camera-list', { id: factoryId })" />
</view>
<view class="flex-col items-center group_12">
<image src="/static/imgs/digital-workshops/camera-tip-bg.png" class="image_2" @click="go2('video-play', { url: cameraList[0].videoUrl })" />
<text class="text_18">{{ cameraList[0].address }}</text>
</view>
</view>
<view class="flex-col section_9">
<!-- <view class="justify-between sticky">
<text class="text_19">设备列表</text>
<view class="flex-row group_14" v-if="!isExample" @click="addDevice">
<text>新增</text>
<image src="/static/imgs/digital-workshops/add-icon.png" class="image_4" />
</view>
</view> -->
<view class="list-area">
<view v-if="listObj[curTab].list && listObj[curTab].list.length > 0">
<DeviceItem v-for="item in listObj[curTab].list" :key="item.id" :deviceInfo="item" style="margin-bottom: 20rpx" @click="jump"></DeviceItem>
</view>
<view v-else>
<view class="flex-col group_9">
<view class="flex-col items-center group_10">
<view class="flex-col items-center image-wrapper">
<image src="/static/imgs/digital-workshops/empty-list.png" class="image_5" />
</view>
<text class="text_10">设备列表为空</text>
</view>
<!-- <view class="flex-col items-center text-wrapper_4" @click="addDevice">
<text>添加设备</text>
</view> -->
</view>
</view>
</view>
</view>
</view>
</view>
<view style="flex-grow: 1;overflow: hidden;" v-show="current == 1">
<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">
<OrderItem v-for="(item, index) in list" :key="item.id" :item="item" :index="index" @click="goDetail"></OrderItem>
</scroll-list>
</view>
</view>
</view> </view>
</template> </template>
<script> <script>
import { go2, back } from '@/utils/hook.js' import { go2, back } from '@/utils/hook.js'
import DeviceItem from './DeviceItem' import DeviceItem from './DeviceItem'
import { getDeviceListV2 } from '@/apis/deviceApi'
import { deviceStatus } from '@/enums/index'
import { getCameraListApi, getMyFactoryList } from '@/apis/factoryApi'
import OrderItem from './OrderItem'
import { deviceStatus, orderStatusList, orderStatusEnum, StatusMap } from '@/enums/index'
import { getCameraListApi, getMyFactoryList, getMachinList } from '@/apis/factoryApi'
import { dateTimeFormat } from '@/utils/index.js'
import { getProdOrderList } from '@/apis/orderApi.js'
export default { export default {
components: { components: {
DeviceItem
DeviceItem,
OrderItem
}, },
data() { data() {
return { return {
contentStyle: 'background: none; padding: 0;text-align: right;color: rgb(255, 255, 255);font-size: 34rpx;',
contentStyle: 'background: none; padding: 0;text-align: right;font-size: 34rpx;',
factoryId: null, factoryId: null,
isExample: false, isExample: false,
listObj: { listObj: {
@ -132,7 +148,23 @@ export default {
{ id: 3, name: '覆膜机', working: 1, free: 1 } { id: 3, name: '覆膜机', working: 1, free: 1 }
], ],
cameraList: [], cameraList: [],
hasCompany: this.$store.state.companyInfo.id
hasCompany: this.$store.state.companyInfo.id,
current: 0,
condition: {
status: -2,
pageNum: 0, //
pageSize: 30
},
option: {
size: 10,
auto: true,
emptyText: '暂无订单~',
background: '#F7F8FA',
emptyImage: '/static/imgs/order/order-empty.png'
},
list: [],
statusBarArray: orderStatusList,
orderStatusMap: Object.freeze(StatusMap)
} }
}, },
onLoad() { onLoad() {
@ -146,6 +178,7 @@ export default {
factoryId(val, oldVal) { factoryId(val, oldVal) {
this.getCameraList() this.getCameraList()
this.getList() this.getList()
this.upCallback()
this.isExample = this.factoryList.find((factory) => factory.value == val).isExample this.isExample = this.factoryList.find((factory) => factory.value == val).isExample
}, },
refresh(val) { refresh(val) {
@ -163,60 +196,73 @@ export default {
}, },
methods: { methods: {
jump(item) { jump(item) {
go2('device-production-info', { id: item.id })
// go2('device-production-info', { id: item.id })
}, },
go2, go2,
back, back,
selectTab(index) { selectTab(index) {
this.curTab = index this.curTab = index
}, },
onClickItem(e) {
if (this.current != e.currentIndex) {
this.current = e.currentIndex;
}
},
getList() { getList() {
getDeviceListV2({ factoryId: this.factoryId, pageSize: 1000 }).then((res) => {
getMachinList({ factoryId: this.factoryId, pageSize: 1000 }).then((res) => {
console.log(res)
let list = res.records let list = res.records
let data = { 所有设备: { name: '所有设备', type: {}, list: [] } } let data = { 所有设备: { name: '所有设备', type: {}, list: [] } }
for (let i = 0; i < list.length; i++) { for (let i = 0; i < list.length; i++) {
let belongWorkshop = list[i].belongWorkshop
if (belongWorkshop) {
if (!data[belongWorkshop]) {
data[belongWorkshop] = {
name: belongWorkshop,
let position = list[i].position
if (position) {
if (!data[position]) {
data[position] = {
name: position,
list: [], list: [],
type: {} type: {}
} }
} }
data[belongWorkshop].list.push(list[i])
data[position].list.push(list[i])
data['所有设备'].list.push(list[i]) data['所有设备'].list.push(list[i])
// 0 1 // 0 1
if (!data[belongWorkshop].type[list[i].typeName]) {
data[belongWorkshop].type[list[i].typeName] = [0, 0]
if (!data[position].type[list[i].typeName]) {
data[position].type[list[i].typeName] = [0, 0]
} }
if (!data['所有设备'].type[list[i].typeName]) { if (!data['所有设备'].type[list[i].typeName]) {
data['所有设备'].type[list[i].typeName] = [0, 0] data['所有设备'].type[list[i].typeName] = [0, 0]
} }
if (list[i].workingStatus === deviceStatus.WORKING) {
data[belongWorkshop].type[list[i].typeName][0]++
data['所有设备'].type[list[i].typeName][0]++
}
if (list[i].workingStatus === deviceStatus.FREE) {
data[belongWorkshop].type[list[i].typeName][1]++
data['所有设备'].type[list[i].typeName][1]++
}
// if (list[i].workingStatus === deviceStatus.WORKING) {
// data[position].type[list[i].typeName][0]++
// data[''].type[list[i].typeName][0]++
// }
// if (list[i].workingStatus === deviceStatus.FREE) {
// data[position].type[list[i].typeName][1]++
// data[''].type[list[i].typeName][1]++
// }
data[position].type[list[i].typeName][0]++
data['所有设备'].type[list[i].typeName][0]++
} else { } else {
data['所有设备'].list.push(list[i]) data['所有设备'].list.push(list[i])
// 0 1 // 0 1
if (!data['所有设备'].type[list[i].typeName]) { if (!data['所有设备'].type[list[i].typeName]) {
data['所有设备'].type[list[i].typeName] = [0, 0] data['所有设备'].type[list[i].typeName] = [0, 0]
} }
if (list[i].workingStatus === deviceStatus.WORKING) {
data['所有设备'].type[list[i].typeName][0]++
}
if (list[i].workingStatus === deviceStatus.FREE) {
data['所有设备'].type[list[i].typeName][1]++
}
// if (list[i].workingStatus === deviceStatus.WORKING) {
// data[''].type[list[i].typeName][0]++
// }
// if (list[i].workingStatus === deviceStatus.FREE) {
// data[''].type[list[i].typeName][1]++
// }
data['所有设备'].type[list[i].typeName][0]++
} }
data['所有设备'].list.push(list[i])
} }
this.listObj = data this.listObj = data
})
}).catch(err => {
console.log(err)
})
}, },
companyTip() { companyTip() {
if (!this.hasCompany) { if (!this.hasCompany) {
@ -268,15 +314,107 @@ export default {
} }
this.factoryId = this.factoryList[0].value this.factoryId = this.factoryList[0].value
}) })
}
},
dateTimeFormat,
fetchOrderList() {
return new Promise((resolve, reject) => {
getProdOrderList({ ...this.condition, status: this.condition.status == -2 ? '' : this.condition.status })
.then((res) => {
if (res) {
var rspList = []
for (var i = 0; i < res.records.length; i++) {
const item = res.records[i]
if(item.productInfoList && item.productInfoList.length){
rspList.push(item)
}
}
if (this.condition.pageNum == 1) {
this.list = rspList
} else {
this.list = this.list.concat(rspList)
}
resolve({ list: this.list, total: rspList.length })
} else {
reject()
}
})
.catch((err) => {
reject(err)
})
})
},
downCallback() {
this.condition.pageNum = 1
this.fetchOrderList()
.then(({ list, total }) => {
this.$refs.list.refreshSuccess({ list, total })
})
.catch(() => {
this.$refs.list.refreshFail()
})
},
upCallback(page) {
this.condition.pageNum++
this.fetchOrderList()
.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) {
go2('order-info', { orderId: order.id })
}
} }
} }
</script> </script>
<style lang="scss" scoped> <style lang="scss" scoped>
.navbar--fixed {
position: fixed;
z-index: 998;
/* #ifdef H5 */
left: var(--window-left);
right: var(--window-right);
/* #endif */
/* #ifndef H5 */
left:0;
right: 0;
/* #endif */
}
.content { .content {
width: 750rpx; width: 750rpx;
// overflow-y: auto;
height: calc(100vh-50px);
display: flex;
flex-direction: column;
flex: 1;
} }
.select-area { .select-area {
max-width: 400rpx; max-width: 400rpx;
@ -296,53 +434,19 @@ export default {
} }
} }
} }
.group {
flex: 1 1 auto;
.section_1 {
padding-top: 82rpx;
background-image: url('/static/imgs/digital-workshops/top-bg.png');
background-position: 0px 0px;
background-size: 100% 100%;
background-repeat: no-repeat;
.section_2 {
padding: 20rpx 32rpx;
background-image: linear-gradient(90deg, rgb(72, 155, 250) 0%, rgb(72, 155, 250) 0%, rgb(24, 108, 224) 100%, rgb(24, 108, 224) 100%);
.group_1 {
color: rgb(255, 255, 255);
font-size: 34rpx;
font-weight: 600;
line-height: 48rpx;
white-space: nowrap;
.image {
margin-left: 11rpx;
align-self: center;
width: 21rpx;
height: 12rpx;
}
}
.text_1 {
margin: 4rpx 0;
color: rgb(255, 255, 255);
font-size: 28rpx;
line-height: 40rpx;
white-space: nowrap;
text-decoration: underline;
}
}
}
.section_3 {
.section_3 {
padding-bottom: 3rpx; padding-bottom: 3rpx;
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
.group_2 { .group_2 {
padding: 0 40rpx;
padding: 0 32rpx;
width: 100%; width: 100%;
overflow-x: auto; overflow-x: auto;
border-bottom: solid 2rpx rgb(221, 221, 221); border-bottom: solid 2rpx rgb(221, 221, 221);
.text-wrapper { .text-wrapper {
color: rgb(136, 136, 136); color: rgb(136, 136, 136);
font-size: 28rpx; font-size: 28rpx;
height: 86rpx;
line-height: 86rpx;
height: 80rpx;
line-height: 80rpx;
white-space: nowrap; white-space: nowrap;
position: relative; position: relative;
text-align: center; text-align: center;
@ -365,6 +469,7 @@ export default {
} }
} }
} }
.bottom-group { .bottom-group {
padding-bottom: 20rpx; padding-bottom: 20rpx;
.section_5 { .section_5 {
@ -460,8 +565,7 @@ export default {
} }
.section_9 { .section_9 {
margin-top: 20rpx; margin-top: 20rpx;
padding: 0 32rpx;
background-color: rgb(255, 255, 255);
padding: 0 24rpx 32rpx 24rpx;
.sticky { .sticky {
position: sticky; position: sticky;
top: 0; top: 0;
@ -531,5 +635,107 @@ export default {
} }
} }
} }
}
.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 #ffffff;
}
.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> </style>

2
pages/factory/index.vue

@ -185,7 +185,7 @@ export default {
<style lang="scss" scoped> <style lang="scss" scoped>
.content { .content {
width: 750rpx; width: 750rpx;
height: 100vh;
height: calc(100vh-50px);
background-color: rgb(255, 255, 255); background-color: rgb(255, 255, 255);
.group_3 { .group_3 {
padding-top: 25rpx; padding-top: 25rpx;

128
pages/order-info/index.vue

@ -0,0 +1,128 @@
<template>
<view>
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="订单详情"></uni-nav-bar>
<view style="padding: 0rpx 24rpx;background-color: white;" v-if="orderInfo">
<view class="list-item flex-col">
<view class="flex-row-center-space" style="height: 72rpx;font-size: 28rpx;">
<view class="flex-row-center-center">
<image src="/static/imgs/tabbar/mine-gray.png" style="width: 48rpx;height: 48rpx;"/>
<view style="margin-left: 8rpx;font-size: 28rpx;">{{orderInfo.customerEnterpriseName}}</view>
</view>
<view :style="{ color: statusColor(orderInfo.status) }">{{orderStatusMap[orderInfo.status]}}</view>
</view>
<view class="flex-row" style="padding: 16rpx 0rpx;border-top: 1rpx solid #f3f3f3;">
<image style="height: 160rpx;width: 160rpx;" :src="orderInfo.purchasingOrderItems[0].imgUrlList[0]"></image>
<view class="flex-col" style="margin-left: 16rpx;flex: 1;">
<view class="flex-row-center-space">
<view style="font-size: 30rpx;">{{orderInfo.purchasingOrderItems[0].productName}}</view>
<view style="font-size: 28rpx;">{{orderInfo.purchasingOrderItems[0].quantity}} {{orderInfo.purchasingOrderItems[0].unit || '个'}}</view>
</view>
<view style="font-size: 24rpx;color: #cccccc;margin-top: 16rpx;">尺寸{{orderInfo.purchasingOrderItems[0].trimmedSize}}</view>
<view style="font-size: 24rpx;color: #cccccc;margin-top: 4rpx;">材质{{orderInfo.purchasingOrderItems[0].materialsRequirement}}</view>
<view class="flex-row-center-start" style="margin-top: 24rpx;">
<image src="/static/imgs/cart/icon-time.png" style="width: 40rpx;height: 40rpx;"/>
<view style="font-size: 28rpx;color: #cccccc;">缴费日期{{orderInfo.deliveryDate}}</view>
</view>
</view>
</view>
</view>
</view>
<view style="margin-top: 16rpx;display: flex;align-items: center;justify-content: center;" v-if="diff">
<text style="margin-right: 12px;font-size: 16px;">还剩</text>
<countdown :day="diff.day" :hour="diff.hours" :minute="diff.minutes" :second="diff.seconds" color="#007AFF" font-size="18"/>
</view>
<view style="display: flex;align-items: center;padding: 24rpx 48rpx 12rpx 48rpx;" v-if="orderInfo">
<view style="background-color: #cccccc;flex: 1;height: 1px;"></view>
<view style="font-size: 28rpx;margin: 0 24rpx;color: #cccccc;">工艺进度</view>
<view style="background-color: #cccccc;flex: 1;height: 1px;"></view>
</view>
<view style="margin-top: 16rpx;background-color: white;padding: 24rpx;" v-if="orderInfo">
<text>{{orderInfo.purchasingOrderItems[0].processRequirement}}</text>
</view>
<view style="padding: 12rpx 24rpx 24rpx 24rpx;" v-if="orderInfo">
<uni-steps :options="stepList" active-color="#007AFF" :active="active" direction="column" />
</view>
</view>
</template>
<script>
import { go2, back } from '@/utils/hook.js'
import { difTime } from '@/utils/index.js'
import { getProdOrderInfo } from '@/apis/orderApi.js'
import { StatusMap } from '@/enums/index'
export default {
data() {
return {
orderId: null,
orderInfo: null,
orderStatusMap: Object.freeze(StatusMap),
active: 1,
stepList: []
}
},
onLoad(option) {
if (option.orderId) {
this.orderId = option.orderId
this.init(this.orderId)
} else {
uni.showToast({
title: '订单信息错误',
icon: 'error',
success: () => {
setTimeout(() => {
back()
}, 2000)
}
})
}
},
onPullDownRefresh() {
uni.stopPullDownRefresh()
},
methods: {
go2,
back,
init(orderId) {
getProdOrderInfo(orderId).then((res) => {
if (res) {
this.orderInfo = res
if(this.orderInfo.deliveryDate){
this.diff = difTime(this.orderInfo.deliveryDate, new Date().getTime())
}
var steps = []
var act = 0
const nodeList = this.orderInfo.purchasingOrderItems[0].processNodeList
for (var i = 0; i < nodeList.length; i++) {
const item = nodeList[i]
if(item.completedQuantity >= item.planQuantity){
act++
}
var desc = item.completedTime || ''
if(item.completedQuantity > 0){
desc += ' 完成' + item.completedQuantity + (item.nodeUnit || '张') + '/'
}
desc += '计划' + item.planQuantity + (item.nodeUnit || '张')
steps.push({title: item.nodeTypeName, desc })
}
this.stepList = steps
this.active = act
}
})
},
statusColor(status){
if(status == 3){
return '#028A00'
}
if(status == 4){
return '#007AFF'
}
return '#999999'
},
}
}
</script>
<style lang="scss" scoped>
</style>

BIN
static/imgs/cart/icon-time.png

Before After
Width: 48  |  Height: 48  |  Size: 1.2 KiB
Loading…
Cancel
Save