123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420 |
- <template>
- <view class="container">
- <view class="information">
- <u-form :model="goods" ref="uForm" class="uForm">
- <u-form-item label="车牌号" prop="carNo" label-width="120" required>
- <u-input v-model="goods.carNo" input-align="right" disabled placeholder="请输入车牌号" maxlength='7' />
- </u-form-item>
- <u-form-item label="毛重(吨)" prop="reciveGrossWeight" label-width="120" required>
- <u-input v-model="goods.reciveGrossWeight" input-align="right" placeholder="请输入毛重"
- @input="grossWeightchange" />
- </u-form-item>
- <u-form-item label="皮重(吨)" prop="reciveTare" label-width="120" required>
- <u-input v-model="goods.reciveTare" input-align="right" placeholder="请输入皮重" @input="tarechange" />
- </u-form-item>
- <u-form-item label="净重(吨)" prop="dispatchNetWeight" label-width="120" required>
- <u-input v-model="goods.dispatchNetWeight" disabled input-align="right" placeholder="自动计算" />
- </u-form-item>
- </u-form>
- </view>
- <view class="information">
- <view class="c-row">
- <view class="action">
- 上传磅单照片
- </view>
- </view>
- <view class="c-row">
- <view class="grid col-4 grid-square flex-sub">
- <view class="bg-img" v-if="goods.reciveCollectionScreenshot != ''" @tap="ViewImage"
- :data-url="goods.reciveCollectionScreenshot">
- <image :src="goods.reciveCollectionScreenshot" mode="aspectFit"></image>
- <view class="cu-tag bg-red" @tap.stop="DelImg" :data-index="0">
- <text class='cuIcon-close'></text>
- </view>
- </view>
- <view class="solids" @tap="ChooseImagePerson" v-if="goods.reciveCollectionScreenshot == ''">
- <text class='cuIcon-cameraadd'></text>
- </view>
- </view>
- </view>
- </view>
- <button class="btn btns" @click="getList">提交</button>
- <!-- </block> -->
- </view>
- </template>
- <script>
- import uploadImage from '@/components/ossutil/uploadFile.js';
- import {
- mapState
- } from 'vuex';
- export default {
- name: "trust",
- data() {
- return {
- goods: {
- reciveCollectionScreenshot: ''
- },
- rules: {
- carNo: [{
- validator: (rule, value, callback) => {
- return !this.$u.test.carNo(value)
- },
- message: '车牌号格式不正确',
- trigger: ['change', 'blur']
- }, ],
- reciveGrossWeight: [{
- validator: (rule, value, callback) => {
- return !this.$u.test.isEmpty(value)
- },
- message: '毛重不能为空',
- trigger: ['change', 'blur']
- },
- {
- validator: (rule, value, callback) => {
- return this.$u.test.amount(value)
- },
- message: '数值类型,最多保留两位小数',
- trigger: ['change', 'blur'],
- },
- {
- validator: (rule, value, callback) => {
- return this.$u.test.range(value, [1, 100])
- },
- message: '数值类型,1-100之间',
- trigger: ['change', 'blur'],
- },
- // {
- // validator: (rule, value, callback) => {
- // if(parseInt(value)>this.goods.reciveNetWeight) return false
- // return true
- // },
- // message: '收货毛重不能大于发货净重',
- // trigger: ['change', 'blur'],
- // },
- ],
- reciveTare: [{
- validator: (rule, value, callback) => {
- return !this.$u.test.isEmpty(value)
- },
- message: '皮重不能为空',
- trigger: ['change', 'blur']
- },
- {
- validator: (rule, value, callback) => {
- return this.$u.test.amount(value)
- },
- message: '数值类型,最多保留两位小数',
- trigger: ['change', 'blur'],
- },
- {
- validator: (rule, value, callback) => {
- return this.$u.test.range(value, [1, 100])
- },
- message: '数值类型,1-50之间',
- trigger: ['change', 'blur'],
- }
- ]
- },
- id: "",
- params: {
- year: true,
- month: true,
- day: true,
- },
- carNo: '',
- PageCur: "trust",
- TabCur: 0,
- priceTypeIndex: -1,
- priceType: ['库内价', '到库价', '到港价'],
- unitPrice: 0,
- price: '',
- seller: '',
- sellerPhone: '',
- minSale: '',
- exsitCount: 0,
- origin: '',
- stock: '',
- show: false,
- goodsName: '',
- verifyCode: '',
-
- buyer: '',
- buyerPhone: '',
- level: '',
- sender: '',
- senderPhone: '',
- receiver: '',
- receiverPhone: '',
- total: 0,
- startPlace: '',
- endPlace: '',
- driver: '',
- driverPhone: '',
- carNo: '',
- personNoImg: '',
- personNoImg1: '',
- driverNoImg: '',
- driverNoImg1: '',
- carNoImg: '',
- carNoImg1: '',
- goodsName: '',
- showTran: true
- };
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- time() {
- var date = new Date()
- var year = date.getFullYear()
- var month = date.getMonth()
- var date1 = date.getDate()
- if (month + 1 < 10) {
- month = "0" + (month + 1)
- }
- if (date1 + 1 < 10) {
- date1 = "0" + date1
- }
- return year + '-' + month + "-" + date1
- },
- startDate() {
- //限制开始时间;
- //也可以直接限定为当天日期 var date= new Date(); return date
- return new Date(new Date(new Date().toLocaleDateString()).getTime() - (1 * 60 * 60 * 1000))
- },
- endDate() {
- return new Date()
- }
- },
- onShow() {},
- onReady() {
- this.$refs.uForm.setRules(this.rules);
- },
- onLoad(options) {
- this.goods = JSON.parse(options.toINfo)
- this.id = options.id;
- this.goods.reciveCollectionScreenshot = this.goods.reciveCollectionScreenshot == null ? '':this.goods.reciveCollectionScreenshot
- },
- methods: {
- DateChange(e) {
- this.goods.sendDateStart = e.year + '-' + e.month + '-' + e.day
- // this.goods.sendDateStart = e.detail.value
- },
- commit1(item) {
- uni.navigateTo({
- url: `/pageB/contract/look?id=${item.id}&netWeight=${item.netWeight}&carNo=${item.carNo}&sendDateStart=${item.sendDateStart}`
- })
- },
- grossWeightchange(e) {
- console.log(e);
- if (this.goods.reciveGrossWeight && this.goods.reciveTare) {
- this.goods.dispatchNetWeight = Number(
- this.goods.reciveGrossWeight - this.goods.reciveTare
- )
- }
- },
- tarechange(e) {
- if (this.goods.reciveGrossWeight && this.goods.reciveTare) {
- this.goods.dispatchNetWeight = Number(
- this.goods.reciveGrossWeight - this.goods.reciveTare
- )
- }
- },
- ChooseImagePerson() {
- uni.chooseImage({
- count: 1, //默认9
- sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
- sourceType: ['album', 'camera'], //从相册选择
- success: (res) => {
- //上传图片
- //图片路径可自行修改
- uploadImage(res.tempFilePaths[0], 'reciveCollectionScreenshot/',
- result => {
- this.goods.reciveCollectionScreenshot = result
- uni.hideLoading();
- }
- )
- }
- });
- },
- DelImg(e) {
- uni.showModal({
- title: '提示',
- content: '确定要删除该照片吗?',
- cancelText: '取消',
- confirmText: '确定',
- success: res => {
- if (res.confirm) {
- this.goods.reciveCollectionScreenshot = ""
- }
- }
- })
- },
- getList() {
- this.utils.nullToString(this.goods)
- var that = this
- uni.showModal({
- content: '确定提交收货信息?',
- success: function(res) {
- if (res.confirm) {
- that.goods.reciveGrossWeight = parseInt(that.goods.reciveGrossWeight)
- that.goods.reciveTare = parseInt(that.goods.reciveTare)
-
- that.$api.doRequest('post',
- '/freightReceivingDispatching/api/confirmFreightReceivingDispatchingCar',
- that.goods).then(
- res => {
- if (res.data.code == 200) {
- console.log(that.goods)
- uni.showModal({
- content: '提交成功!',
- success: function(res) {
- if (res.confirm) {
- that.$store.commit(
- 'configfreightTransport', false)
- uni.navigateTo({
- url: `/pageA/freightTransport/record/payrecord?id=` +that.id
- })
- // var result = that.goods.tranCarNo.substr(
- // that.goods.tranCarNo.indexOf("C") +
- // 1, that.goods.tranCarNo.length);
- // var num = Number(result) + 1
- // if (num <= 9) {
- // num = 'C00' + num
- // } else if (num < 100 && num > 9) {
- // num = 'C0' + num
- // } else if (num < 1000 && num > 99) {
- // num = 'C' + num
- // }
- // that.goods = {
- // tranCarNo: num,
- // carNo: '',
- // grossWeight: '',
- // tare: '',
- // loadNetWeight: '',
- // loadPoundImg: '',
- // contractNo: that.contractNo,
- // goodsName: that.goodsName,
- // sendDateStart: ''
- // }
- } else if (res.cancel) {
- // uni.navigateBack();
- }
- }
- });
- } else if (res.data.code == 11015) {
- // uni.showToast({
- // title: '该司机未认证身份,请司机认证后再操作',
- // icon: 'none',
- // duration: 2000
- // })
- }
- })
- .catch(res => {
- if(res.errmsg){
- uni.showToast({
- title: res.errmsg,
- icon: 'none',
- duration: 2000
- })
- }
- else{
- uni.showToast({
- title: "系统异常,请联系管理员",
- icon: 'none',
- duration: 2000
- })
- }
- });
- } else if (res.cancel) {
- }
- }
- });
- },
- },
- }
- </script>
- <style scoped>
- .container {
- padding: 10px 10px;
- background-color: #F5F6FA;
- }
- .title1 {
- font-size: 18px;
- font-weight: 600;
- }
- .cu-form-group input {
- text-align: right;
- }
- .text-white text {
- background: linear-gradient(45deg, #3DC146, #B2D612);
- padding: 5px 10px;
- border-radius: 38rpx;
- }
- .cu-form-group textarea {
- text-align: right;
- }
- .commit {
- background: linear-gradient(45deg, #DF331C, #DA611A);
- color: #fff;
- }
- .c-row {
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-align: center;
- -webkit-align-items: center;
- align-items: center;
- padding: 20rpx 30rpx;
- position: relative;
- }
- .con-list {
- -webkit-box-flex: 1;
- -webkit-flex: 1;
- flex: 1;
- display: -webkit-box;
- display: -webkit-flex;
- display: flex;
- -webkit-box-orient: vertical;
- -webkit-box-direction: normal;
- -webkit-flex-direction: column;
- flex-direction: column;
- color: #303133;
- line-height: 40rpx;
- text-align: right;
- padding-right: 20rpx;
- font-size: 14px;
- }
- .information {
- background-color: #FFFFFF;
- border-radius: 20px;
- margin-top: 10px;
- }
- .btn {
- margin-top: 10px;
- border-radius: 25px;
- background-color: #22C572;
- border: none;
- color: #FFFFFF;
- }
- .uForm {
- padding: 0 40rpx;
- }
- </style>
|