Browse Source

no message

devlop
xpz2018 3 years ago
parent
commit
91b1865c11
7 changed files with 331 additions and 10 deletions
  1. 10
      apis/deviceApi.js
  2. 8
      apis/orderApi.js
  3. 276
      pages/device-production-info/OrderItem.vue
  4. 36
      pages/device-production-info/index.vue
  5. 2
      pages/digital-workshops/index.vue
  6. 4
      pages/order-info/index.vue
  7. 5
      utils/http/index.js

10
apis/deviceApi.js

@ -113,3 +113,13 @@ export function getDeviceListV2(data = {}) {
data
})
}
/**
* 获取监控设备的token
*/
export function getMachineInfo(machineId, data = {}) {
return http.get({
url: `/printing-packaging-factory-service/user/get/factory/machine/${machineId}`,
data
})
}

8
apis/orderApi.js

@ -185,3 +185,11 @@ export const getProdOrderInfo = (id) => {
url: `/cloud-print-cloud-factory/get/my-enterprise/purchasing-order/${id}`
})
}
export const getOrderListByMachine = (machineId, data) => {
return http.get({
url: `/printing-packaging-factory-service/user/get/production-task/list/by/${machineId}`,
data
})
}

276
pages/device-production-info/OrderItem.vue

@ -0,0 +1,276 @@
<template>
<view class="list-item flex-col" style="margin-top: 24rpx;" @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) }">生产中</view>
</view>
<view class="flex-row" style="padding: 16rpx 0rpx;border-top: 1rpx solid #f3f3f3;">
<image style="height: 160rpx;width: 160rpx;" :src="item.productImgUrl"></image>
<view class="flex-col" style="margin-left: 16rpx;flex: 1;">
<view class="flex-row-center-space">
<view style="font-size: 30rpx;">{{item.productName}}</view>
<view style="font-size: 28rpx;">{{item.quantityCompletion}} / {{item.productionQuantity}}</view>
</view>
<view style="font-size: 24rpx;color: #cccccc;margin-top: 16rpx;">尺寸{{item.trimmedSize}}</view>
<view style="font-size: 24rpx;color: #cccccc;margin-top: 4rpx;" v-if="item.materialsRequirement">材质{{item.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.finishDate || '- -'}}</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>

36
pages/device-production-info/index.vue

@ -3,9 +3,9 @@
<uni-nav-bar left-icon="back" @clickLeft="back" statusBar fixed title="生产设备详情">
<view slot="right"><text class="text_4" @click="popupShow">分享</text></view>
</uni-nav-bar>
<view class="flex-col items-center group_1" v-if="info.videoUrl || (info.imgItemList && info.imgItemList[0])">
<image v-if="info.videoUrl" src="/static/imgs/digital-workshops/camera-tip-bg.png" class="image_2" @click="go2('video-play', { url: info.videoUrl })" />
<image v-else :src="info.imgItemList[0].url" class="image_2" />
<view class="flex-col items-center group_1" v-if="info.hlsUrl || (info.imgUrlList && info.imgUrlList[0])">
<image v-if="info.hlsUrl" src="/static/imgs/digital-workshops/camera-tip-bg.png" class="image_2" @click="go2('video-play', { url: info.hlsUrl })" />
<image v-else :src="info.imgUrlList[0].url" class="image_2" />
</view>
<view class="flex-col group_6">
<view class="flex-col">
@ -74,6 +74,13 @@
<text>暂无购置信息</text>
</view>
</view>
<view v-if="orderList.length">
<OrderItem v-for="(item, index) in orderList" :key="item.orderId" :item="item" :index="index" @click="goDetail"></OrderItem>
<view style="height: 24rpx;"></view>
</view>
<view class="flex-col items-center empty-info" style="margin-top: 16rpx;" v-else>
暂无生产中的订单
</view>
<uni-popup ref="popup" type="bottom">
<view class="flex-col group_10">
<view class="flex-col section_7">
@ -124,8 +131,10 @@
</template>
<script>
import OrderItem from './OrderItem'
import { go2, back } from '@/utils/hook.js'
import { getEquipmentInfo, makeDeviceShare } from '@/apis/deviceApi'
import { getMachineInfo, makeDeviceShare } from '@/apis/deviceApi'
import { getOrderListByMachine } from '@/apis/orderApi.js'
import { H5_URL_DEVICE, isEncrypt } from '@/enums/index.js'
const tabList = [
{ name: '生产情况', key: 1 },
@ -133,6 +142,9 @@ const tabList = [
{ name: '购置信息', key: 3 }
]
export default {
components: {
OrderItem
},
data() {
return {
id: null,
@ -140,12 +152,14 @@ export default {
tabList: Object.freeze(tabList),
curTab: 1,
hasPassword: true,
password: ''
password: '',
orderList: []
}
},
onLoad(options) {
if (options.id) {
this.id = options.id
this.factoryId = options.factoryId
}
},
watch: {
@ -158,11 +172,17 @@ export default {
back,
getInfo() {
if (this.id) {
getEquipmentInfo({ id: this.id }).then((res) => {
getMachineInfo(this.id, {factoryId: this.factoryId}).then((res) => {
if (res) {
this.info = res
}
})
uni.setStorageSync('factoryId', this.factoryId)
getOrderListByMachine(this.id, {status: 1}).then((res) => {
if (res && res.productionTaskList && res.productionTaskList.length) {
this.orderList = res.productionTaskList
}
})
}
},
translate(time) {
@ -192,6 +212,10 @@ export default {
selectMethod(isPassword) {
this.hasPassword = isPassword
},
//
goDetail(order) {
go2('order-info', { orderId: order.orderId })
},
share(scene) {
//
if (this.hasPassword && !this.password) {

2
pages/digital-workshops/index.vue

@ -202,7 +202,7 @@ export default {
},
methods: {
jump(item) {
go2('device-production-info', { id: item.id })
go2('device-production-info', { id: item.id, factoryId: this.factoryId })
},
go2,
back,

4
pages/order-info/index.vue

@ -21,7 +21,7 @@
<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 style="font-size: 28rpx;color: #cccccc;">交付日期{{orderInfo.deliveryDate}}</view>
</view>
</view>
</view>
@ -36,7 +36,7 @@
<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">
<view style="margin-top: 16rpx;background-color: white;padding: 24rpx;" v-if="orderInfo && orderInfo.purchasingOrderItems[0].processRequirement">
<text>{{orderInfo.purchasingOrderItems[0].processRequirement}}</text>
</view>
<view style="padding: 12rpx 24rpx 24rpx 24rpx;" v-if="orderInfo">

5
utils/http/index.js

@ -40,19 +40,22 @@ const reqInterceptor = (config, options) => {
const { url } = config
// 添加token
let token = ''
let factoryId = ''
try {
if (url.startsWith('uec')) {
token = uni.getStorageSync('uecToken')
} else {
token = uni.getStorageSync('qnToken')
}
factoryId = uni.getStorageSync('factoryId')
} catch (e) {
console.error('获取缓存失败:', e)
}
config.header = {
...config.header,
Authorization: token || '',
'X-APP-ID': XAPPID
'X-APP-ID': XAPPID,
'X-FACTORY-ID': factoryId
}
// 改变url
let newUrl = ''

Loading…
Cancel
Save