4月15日提交

master
rosehan 2 years ago
parent 1e89c208ea
commit 83658c86fe
  1. 62
      App.vue
  2. 97
      components/DictTag/index.vue
  3. 139
      pages/traceability-product/delivery/deliveryEdit.vue
  4. 58
      pages/traceability-product/index.vue
  5. 7
      pages/traceability-product/loss/lossEdit.vue
  6. 5
      pages/traceability-product/sales/salesEdit.vue
  7. 35
      static/scss/v-layout.scss
  8. 6
      utils/mix.js

@ -1,35 +1,37 @@
<script>
import config from './config'
import store from '@/store'
import { getAccessToken } from '@/utils/auth'
import config from './config'
import store from '@/store'
import {
getAccessToken
} from '@/utils/auth'
export default {
onLaunch: function() {
this.initApp()
},
methods: {
//
initApp() {
//
this.initConfig()
//
//#ifdef H5
this.checkLogin()
//#endif
},
initConfig() {
this.globalData.config = config
},
checkLogin() {
if (!getAccessToken()) {
this.$tab.reLaunch('/pages/login')
}
}
}
}
export default {
onLaunch: function() {
this.initApp()
},
methods: {
//
initApp() {
//
this.initConfig()
//
//#ifdef H5
this.checkLogin()
//#endif
},
initConfig() {
this.globalData.config = config
},
checkLogin() {
if (!getAccessToken()) {
this.$tab.reLaunch('/pages/login')
}
}
}
}
</script>
<style lang="scss">
<style lang="scss">
@import "@/uni_modules/uview-ui/index.scss";
@import '@/static/scss/index.scss'
</style>
@import '@/static/scss/index.scss'
</style>

@ -1,57 +1,56 @@
<template>
<span class="v-dict">
<template v-for="(dict, index) in arr">
<!-- 默认样式 -->
<span v-if="dict.colorType === 'default' || dict.colorType === '' || dict.colorType === undefined"
class="v-dict-text"
:key="dict.value" :index="index"
:class="dict.cssClass"
>{{ dict.label }}</span>
<!-- Tag 样式 -->
<span v-else
class="v-dict-text"
:key="dict.value"
:index="index"
:type="dict.colorType"
:class="dict.cssClass"
>
{{ dict.label }}
</span>
</template>
</span>
<span class="v-dict">
<template v-for="(dict, index) in arr">
<!-- 默认样式 -->
<span v-if="dict.colorType === 'default' || dict.colorType === '' || dict.colorType === undefined"
class="v-dict-text" :key="dict.value" :index="index" :class="dict.cssClass">{{ dict.label }}</span>
<!-- Tag 样式 -->
<span v-else class="v-dict-text" :key="dict.value" :index="index" :type="dict.colorType"
:class="dict.cssClass">
{{ dict.label }}
</span>
</template>
</span>
</template>
<script>
import {getDictDatas2} from '@/utils/dict.js'
export default {
name: 'DictTag',
props: {
type: String,
value: [Number, String, Boolean, Array]
},
data(){
return{
arr:undefined
}
},
watch:{
value:{
handler(val){
if(val){
this.arr = this.getDictDatas2(this.type, val)
}
},
immediate:true,
deep:true
import {
getDictDatas2
} from '@/utils/dict.js'
export default {
name: 'DictTag',
props: {
type: String,
value: [Number, String, Boolean, Array]
},
data() {
return {
arr: undefined
}
},
watch: {
value: {
handler(val) {
if (val) {
this.arr = this.getDictDatas2(this.type, val)
}
},
immediate: true,
deep: true
}
},
mounted() {
}
}
}
</script>
<style scoped lang="scss">
.v-dict {
& + .v-dict {
margin-left: 10px;
}
&-text{font-size: 14rem;}
.v-dict {
&+.v-dict {
margin-left: 10px;
}
}
</style>
&-text {
font-size: 14px;
}
}
</style>

@ -2,24 +2,64 @@
<view class="v-pages">
<!-- 页面 产品 -->
<view class="v-pages-product">
<view class="image">
<image src="../../static/test/pic.jpg" class="v-card-image"></image>
</view>
<view class="name">{{formData.productName}}</view>
<view class="code">{{formData.traceabilityProduct}}</view>
</view>
<!-- 页面 表单 -->
<view class="v-form v-container" style="margin-top: -40px;">
<uni-forms :modelValue="formData" ref="formRef" :label-width="80" border :rules="formRules">
<uni-forms :modelValue="formData" ref="formRef" :label-width="80" border :rules="formRules">
<view class="v-form-item">
<uni-forms-item label="配送公司" name="customId">
<view class="v-form-tip delivery m-t-small"></view>
<uni-forms-item label="配送公司" name="logisticsId">
<uni-data-picker v-model="formData.logisticsId" :localdata="customList"
@change="getCustomChange"></uni-data-picker>
</uni-forms-item>
<uni-forms-item label="配送人" name="deliveryMan">
<uni-easyinput v-model="formData.deliveryMan" placeholder="请输入配送人" />
</uni-forms-item>
<uni-forms-item label="配送日期" name="deliveryTime">
<uni-datetime-picker type="date" :clear-icon="false" v-model="formData.deliveryTime"
@maskClick="maskClick" />
</uni-forms-item>
<uni-forms-item label="所在地区">
<view @tap="startOpen">
<text
v-if="startLocalData">{{startLocalData.provinceName}}/{{startLocalData.cityName}}/{{startLocalData.provinceName}}</text>
<text class="placeholder" v-else>请选择所在地区</text>
<uni-icons type="down" size="14"></uni-icons>
</view>
<cityPicker :column="column" :default-value="defaultValue" :mask-close-able="startMaskCloseAble"
@confirm="startConfirm" @cancel="startCancel" :visible="startVisible" />
</uni-forms-item>
<uni-forms-item label="详细地址" name="startAddress">
<uni-easyinput v-model="formData.startAddress" placeholder="请输入详细地址" />
</uni-forms-item>
</view>
<view class="v-form-item">
<view class="v-form-tip received m-t-small"></view>
<uni-forms-item label="接收人" name="receivedMan">
<uni-easyinput v-model="formData.receivedMan" placeholder="请输入接收人" />
</uni-forms-item>
<uni-forms-item label="接收日期" name="receivedTime">
<uni-datetime-picker type="date" :clear-icon="false" v-model="formData.receivedTime"
@maskClick="maskClick" />
</uni-forms-item>
<uni-forms-item label="所在地区">
<view @tap="endOpen">
<text
v-if="endLocalData">{{endLocalData.provinceName}}/{{endLocalData.cityName}}/{{endLocalData.provinceName}}</text>
<text class="placeholder" v-else>请选择所在地区</text>
<uni-icons type="down" size="14"></uni-icons>
</view>
<cityPicker :column="column" :default-value="defaultValue" :mask-close-able="endMaskCloseAble"
@confirm="endConfirm" @cancel="endCancel" :visible="endVisible" />
</uni-forms-item>
<uni-forms-item label="详细地址" name="endAddress">
<uni-easyinput v-model="formData.endAddress" placeholder="请输入详细地址" />
</uni-forms-item>
</view>
</uni-forms>
<button class="m-t-large v-primary-btn large" @click="submitForm()">保存</button>
</view>
@ -29,13 +69,29 @@
<script>
import * as ProductApi from "@/api/traceability/product"
import * as customApi from "@/api/traceability/custom"
import cityPicker from '@/uni_modules/piaoyi-cityPicker/components/piaoyi-cityPicker/piaoyi-cityPicker'
import {
getDictDatas,
DICT_TYPE
} from '@/utils/dict';
export default {
components: {
cityPicker
},
data() {
return {
defaultValue: '110101',
// defaultValue: ['','',''],
column: 3,
startVisible: false,
startMaskCloseAble: true,
startLocalData: null,
endVisible: false,
endMaskCloseAble: true,
endLocalData: null,
ProductID: null,
ClientList: [],
customList: [],
@ -44,23 +100,53 @@
id: undefined,
productId: undefined,
productName: undefined,
traceabilityProduct: undefined,
logisticsId: undefined,
deliveryTime: undefined,
receivedTime: undefined,
deliveryMan: undefined,
receivedMan: undefined,
startProvince: undefined,
startCity: undefined,
startCountry: undefined,
startAddress: undefined,
endProvince: undefined,
endCity: undefined,
endCountry: undefined,
endAddress: undefined
},
//
formRules: {
lossType: {
logisticsId: [{
required: true,
errorMessage: '请选择配送公司'
}]
},
deliveryMan: {
rules: [{
required: true,
errorMessage: '请选择配送人'
}]
},
deliveryTime: {
rules: [{
required: true,
errorMessage: '请选择配送日期'
}]
},
startAddress: {
rules: [{
required: true,
errorMessage: '请选择报损类型'
errorMessage: '请输入详细地址'
}]
},
productLoss: {
endAddress: {
rules: [{
required: true,
errorMessage: '报损数量不能为空'
errorMessage: '请输入详细地址'
}]
}
},
},
}
@ -92,6 +178,8 @@
const res = await ProductApi.getAllTraceableProducts(id)
this.formData.productId = id
this.formData.productName = res.data[0].processingName
this.formData.traceabilityProduct = res.data[0].traceabilityProduct
this.formData.deliveryTime = new Date().valueOf()
} finally {}
},
@ -99,7 +187,12 @@
submitForm() {
//
this.$refs['formRef'].validate().then(res => {
console.log('success', res);
this.formData.startProvince = this.startLocalData.provinceName
this.formData.startCity = this.startLocalData.cityName
this.formData.startCountry = this.startLocalData.areaName
this.formData.endProvince = this.endLocalData.provinceName
this.formData.endCity = this.endLocalData.cityName
this.formData.endCountry = this.endLocalData.areaName
uni.showToast({
title: `保存成功`
})
@ -140,9 +233,31 @@
}
})
} finally {}
},
//
startOpen() {
this.startVisible = true
},
startConfirm(val) {
this.startLocalData = val
this.startVisible = false
},
startCancel() {
this.startVisible = false
},
//
endOpen() {
this.endVisible = true
},
endConfirm(val) {
this.endLocalData = val
this.endVisible = false
},
endCancel() {
this.endVisible = false
}
}
};
},
}
</script>
<style>

@ -18,16 +18,14 @@
<view class="v-card-content">
<!-- 卡片 上部 -->
<view class="v-card-top row">
<!-- 卡片 图片 -->
<image src="../../static/test/pic.jpg" class="v-card-image"></image>
<!-- 卡片 信息 -->
<view class="v-card-info col">
<view class="v-card-title row">
<text class="name col">{{item.processingName}}</text>
<text class="tip">{{item.speciesName}}</text>
<text class="tip" v-if="item.speciesName">{{item.speciesName}}</text>
</view>
<view class="v-card-state">
<text class="state">{{item.sourceType}}</text>
<dict-tag type="source_type" :value="item.sourceType" />
</view>
<view class="v-card-item">{{item.traceabilityCode}}</view>
</view>
@ -35,8 +33,10 @@
<!-- 卡片 下部 -->
<view class="v-card-bot">
<view class="v-page-form small row">
<view class="v-form-item col-12"><text>收获数量</text>5000公斤</view>
<view class="v-form-item col-12"><text>收获时间</text>2024-01-07</view>
<view class="v-form-item col-12"><text>收获数量</text>{{item.inventoryProduction}}公斤
</view>
<view class="v-form-item col-12"><text>收获时间</text>{{getData(item.createTime)}}
</view>
</view>
</view>
</view>
@ -46,11 +46,19 @@
</u-list>
</view>
<view class="v-pages-operation row">
<div class="v-pages-operation-item col-6" @click="GoToPage('delivery')">配送</div>
<div class="v-pages-operation-item col-6" @click="GoToPage('sales')">销售</div>
<div class="v-pages-operation-item col-6" @click="GoToPage('loss')">报损</div>
<div class="v-pages-operation-item col-6" @click="deleteProduct()">删除</div>
<view class="v-pages-operation row" :class="Product==-1?'show':'hide'">
<div class="v-pages-operation-item col-6" @click="GoToPage('delivery')">
<view class="v-secondary-btn"><text class="iconfont icon-delivery"></text>配送</view>
</div>
<div class="v-pages-operation-item col-6" @click="GoToPage('sales')">
<view class="v-secondary-btn"><text class="iconfont icon-sales"></text>销售</view>
</div>
<div class="v-pages-operation-item col-6" @click="GoToPage('loss')">
<view class="v-secondary-btn"><text class="iconfont icon-bad"></text>报损</view>
</div>
<div class="v-pages-operation-item col-6" @click="deleteProduct()">
<view class="v-secondary-btn"><text class="iconfont icon-delete"></text>删除</view>
</div>
</view>
</view>
</template>
@ -58,8 +66,16 @@
<script>
import * as ProductApi from "@/api/traceability/product"
import mix from '@/utils/mix.js'
import DictTag from "@/components/DictTag/index"
import {
getDictDatas,
DICT_TYPE
} from '@/utils/dict';
export default {
components: {
DictTag
},
data() {
return {
value1: 1,
@ -76,9 +92,12 @@
processingName: null,
total: null
},
Product: null
Product: -1
}
},
mounted() {
console.log("badfa",DICT_TYPE.SOURCE_TYPE)
},
watch: {
"queryParams.processingName"(newV, oldV) {
if (newV == "") {
@ -100,13 +119,13 @@
});
break;
case "sales":
console.log(this.Product)
console.log(this.Product)
wx.navigateTo({
url: '/pages/traceability-product/sales/salesEdit?id=' + this.Product
});
break;
case "loss":
console.log(this.Product)
console.log(this.Product)
wx.navigateTo({
url: '/pages/traceability-product/loss/lossEdit?id=' + this.Product
});
@ -132,7 +151,12 @@
//
getProduct(value) {
this.Product = value
if (this.Product != value) {
this.Product = value
} else {
this.Product = -1
}
},
//
@ -187,4 +211,4 @@
<style lang="scss">
</style>
</style>

@ -1,10 +1,7 @@
<template>
<view class="v-pages">
<!-- 页面 产品 -->
<view class="v-pages-product">
<view class="image">
<image src="../../static/test/pic.jpg" class="v-card-image"></image>
</view>
<view class="v-pages-product">
<view class="name">{{formData.productName}}</view>
<view class="code">{{formData.traceabilityProduct}}</view>
</view>
@ -44,6 +41,7 @@
formData: {
productId: undefined,
productName: undefined,
traceabilityProduct: undefined,
lossType: undefined,
productLoss: undefined,
lossReason: undefined
@ -93,6 +91,7 @@
const res = await ProductApi.getAllTraceableProducts(id)
this.formData.productId = id
this.formData.productName = res.data[0].processingName
this.formData.traceabilityProduct = res.data[0].traceabilityProduct
this.formData.lossType = "2"
} finally {}

@ -1,10 +1,7 @@
<template>
<view class="v-pages">
<!-- 页面 产品 -->
<view class="v-pages-product">
<view class="image">
<image src="../../static/test/pic.jpg" class="v-card-image"></image>
</view>
<view class="v-pages-product">
<view class="name">{{formData.productName}}</view>
<view class="code">{{formData.traceabilityProduct}}</view>
</view>

@ -1,4 +1,5 @@
$v-primary: #14c171;
$v-secondary: #dddddd;
/* 字体引入 */
@font-face {
font-family: DIN Alternate;
@ -32,7 +33,8 @@ $v-primary: #14c171;
}
}
}
.v-primary-btn {
.text-secondary {color: $v-secondary;}
.v-primary-btn {
font-size: 12px;
height: 20px;
padding: 0 10px;
@ -52,6 +54,20 @@ $v-primary: #14c171;
background-color: $v-primary;
border: 1px solid $v-primary;
}
.v-secondary-btn {
display: inline-block;
padding: 0 10px;
color: $v-primary;
height: 30px;
font-size: 14px;
line-height: 30px;
border-radius: 30px;
background-color: #fff;
border: 1px solid $v-primary;
}
.v-primary-btn.circle {
border-radius: 20px;
}
@ -213,6 +229,11 @@ $v-primary: #14c171;
border-radius: 10px;
margin: 10px 0;
}
.uni-easyinput-error{color: #606266;}
.v-form-tip{display: inline-block;height: 30px;width: 30px; text-align: center; line-height: 30px; border-radius: 30px; color: #fff;}
.v-form-tip.delivery{background-color: #14c171;}
.v-form-tip.received{background-color: rgb(255, 102, 102);}
.placeholder{font-size: 13px;color: #999999; padding-right: 15px;}
.uni-forms-item {
position: relative;
margin: 0;
@ -281,6 +302,7 @@ $v-primary: #14c171;
.uni-forms-item__content {
text-align: right;
line-height: 36px;
text{font-size: 13px;}
}
.uni-forms-item--border .uni-forms-item__content .uni-forms-item__error {
position: absolute;
@ -303,16 +325,21 @@ $v-primary: #14c171;
}
.v-pages-operation {
position: fixed;
bottom: 0;
position: fixed;
left: 0;
width: 100%;
padding: 10px;
box-shadow: -4px 0 10px 0 rgba(0, 0, 0, 0.05);
background-color: #fff;
transition: all .4s;
&.show{bottom:-40px}
&.hide{bottom:0}
.v-pages-operation-item {
text-align: center;
text-align: center;
}
}
.v-pages-product {
padding: 30px 0 50px 0;
background-color: rgba(20, 193, 113, 1);

@ -12,8 +12,7 @@ export default {
/** 时间戳处理 */
getData(timestamp) {
let date = new Date(parseInt(timestamp))
console.log('timestamp',date)
let date = new Date(parseInt(timestamp))
let Year = date.getFullYear()
let Moth = (date.getMonth() + 1 < 10 ? '0' + (date.getMonth() + 1) : date.getMonth() + 1)
let Day = (date.getDate() < 10 ? '0' + date.getDate() : date.getDate())
@ -22,8 +21,7 @@ export default {
},
/** 日期格式化 */
getFormat(timestamp) {
getFormat(timestamp) {
if (timestamp == undefined || timestamp == null) {
return undefined
} else {

Loading…
Cancel
Save