123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697 |
- <template>
- <view class="content">
- <view class="fixed1"></view>
- <view class='title flex'>
- <u-icon class="back" name="arrow-left" color="" size="20" @click="back"></u-icon>
- <view class="nav-title">发布</view>
- <view class="search" @click="goToRecord">
- <u-icon class="" name="order" color="" size="28"></u-icon>
- <view>
- 记录
- </view>
- </view>
- </view>
- <view class="content1">
- <view class="row" @click="selectCargoOwner" v-if="!dataObj.cargoOwner">
- <view class="left select-sf">选择货主身份</view>
- <view class="right">></view>
- </view>
- <view class="row" @click="selectCargoOwner" v-if="dataObj.cargoOwner">
- <view class="left">{{dataObj.cargoOwner}}</view>
- <view class="right">></view>
- </view>
- <u-picker :show="show" :columns="columns" :closeOnClickOverlay='true' @close='selectCargoOwnerClose'
- @cancel='selectCargoOwnerClose' @confirm='confirmSelectCargoOwner'></u-picker>
- </view>
- <view class="content2">
- <view class="row1">
- <view class="left">
- <view class="top" @click="selectAddress(0)">
- <view class="send">寄</view>
- <view class="title">
- {{dataObj.sendArea?(dataObj.sendPrivate + dataObj.sendCity+dataObj.sendArea):'选择发货地区'}}
- </view>
- </view>
- <view class="bottom">
- <input type="text" value="" placeholder="输入详细地址" v-model="dataObj.sendDetailedAddress" />
- </view>
- </view>
- <view class="right" @click="selectAddress(0)" v-if="!dataObj.sendArea">
- <view class="right">{{dataObj.sendArea?'':'>'}}</view>
- </view>
- </view>
- <view class="row2">
- <view class="left">
- <view class="top" @click="selectAddress(1)">
- <view class="collect">收</view>
- <view class="title">
- {{dataObj.unloadArea?(dataObj.unloadPrivate + dataObj.unloadCity+dataObj.unloadArea):'选择收货地区'}}
- </view>
- </view>
- <view class="bottom">
- <input type="text" value="" placeholder="输入详细地址" v-model="dataObj.unloadDetailedAddress" />
- </view>
- </view>
- <view class="right" @click="selectAddress(1)" v-if="!dataObj.unloadArea">
- <view class="right">{{dataObj.unloadArea?(dataObj.unloadCity+dataObj.unloadArea):'>'}}</view>
- </view>
- </view>
- </view>
- <view class="content3">
- <view class="row">
- <view class="left">距离</view>
- <input type="text" value="" class="input" placeholder="自动计算" v-model="dataObj.distance" disabled="" />
- </view>
- <view class="row">
- <view class="left">货名</view>
- <view class="right"><input type="text" class="input" value="" placeholder="输入货物名称"
- v-model="dataObj.goodsName" /></view>
- </view>
- <view class="flex row">
- <view class="left-text">运费计算方式</view>
- <!-- <u-radio-group v-model="dataDetails.driverSex" placement="row"> -->
- <u-radio-group placement="row" v-model="dataObj.billingMethod" class="select-type">
- <u-radio :customStyle="radioCustomStyle" v-for="(item, index) in radiolist1" :key="index"
- :label="item.name" :name="item.name" @change="radioChange">
- </u-radio>
- </u-radio-group>
- </view>
- <view class="row">
- <view class="left">运费单价</view>
- <view class="right"><input type="text" value="" placeholder="输入运费单价" class="input"
- v-model="dataObj.freightPrice" /></view>
- </view>
- <view class="row">
- <view class="left">该任务申请运费垫付</view>
- <view class="right">
- <u-switch v-model="dataObj.freightAdvance" @change="change" size="20"></u-switch>
- </view>
- </view>
- </view>
- <view class="content4 flex">
- <view class="title">以下为附加信息</view>
- <view class="btn-text">选填</view>
- </view>
- <view class="content5">
- <view class="row">
- <view class="left">发货联系人</view>
- <view class="right flex">
- <input type="text" value="" placeholder="输入发货联系人姓名" class="input" v-model="dataObj.sender" />
- </view>
- </view>
- <view class="row">
- <view class="left">发货联系人电话</view>
- <view class="right flex">
- <input type="text" value="" placeholder="输入发货联系人手机号" class="input" v-model="dataObj.senderPhone" />
- </view>
- </view>
- <view class="row">
- <view class="left">收货联系人</view>
- <view class="right flex">
- <input type="text" value="" placeholder="输入收货联系人姓名" class="input" v-model="dataObj.receiver" />
- </view>
- </view>
- <view class="row">
- <view class="left">收货联系人电话</view>
- <view class="right flex">
- <input type="text" value="" placeholder="输入收货联系人手机号" class="input"
- v-model="dataObj.receiverPhone" />
- </view>
- </view>
- <view class="row">
- <view class="left">重量(吨)</view>
- <view class="right flex">
- <input type="text" value="" placeholder="输入预计发运重量" class="input" v-model="dataObj.weight" />
- </view>
- </view>
- <view class="flex row" @click="selectValidityPeriod(0)">
- <view class="left-text">预计装车日期起</view>
- <view :class="!dataObj.loadingDateStart?'select-data':''">
- {{dataObj.loadingDateStart?dataObj.loadingDateStart:'选择有效截止日期>'}}
- </view>
- </view>
- <view class="flex row" @click="selectValidityPeriod(1)">
- <view class="left-text">预计装车日期止</view>
- <view :class="!dataObj.loadingDateEnd?'select-data':''">
- {{dataObj.loadingDateEnd?dataObj.loadingDateEnd:'选择有效截止日期>'}}
- </view>
- </view>
- <view class="row">
- <view class="left">车长要求(米)</view>
- </view>
- <view class="row flex-space-between row-bgc">
- <view class="car-row">
- <input type="text" value="" placeholder="最短不限" class="" v-model="dataObj.carLengthSmall"
- class="car-input" />
- <view>m</view>
- </view>
- <view class="car-line">-</view>
- <view class="car-row">
- <input type="text" value="" placeholder="最长不限" class="" v-model="dataObj.carLength"
- class="car-input" />
- <view>m</view>
- </view>
- </view>
- <view class="row">
- <view class="left">载重要求(吨)</view>
- </view>
- <view class="row flex-space-between row-bgc">
- <view class="car-row">
- <input type="text" value="" placeholder="最小不限" class="car-input"
- v-model="dataObj.loadWeightSmall" />
- <view>吨</view>
- </view>
- <view class="car-line">-</view>
- <view class="car-row">
- <input type="text" value="" placeholder="最大不限" class="car-input" v-model="dataObj.loadWeight" />
- <view>吨</view>
- </view>
- </view>
- <view class="row">
- <view class="left">车型要求</view>
- </view>
- <view class="row">
- <u-checkbox-group v-model="checkboxValue1" placement="row" @change="checkboxChange">
- <u-checkbox :customStyle="radioCustomStyle" v-for="(item, index) in checkboxList1" :key="index"
- :label="item.name" :name="item.name">
- </u-checkbox>
- </u-checkbox-group>
- </view>
- <view class="row">
- <view class="left">任务描述</view>
- </view>
- <view class="row">
- <u--textarea v-model="dataObj.taskDescription" placeholder="请输入内容"></u--textarea>
- </view>
- <view class="flex row noborder">
- <view class="left-text">任务有效期</view>
- <view :class="dataObj.taskValidity?'':'select-data'" @click="selectValidityPeriodcq">
- {{dataObj.taskValidity?dataObj.taskValidity:'选择任务有效期>'}}
- </view>
- </view>
- <u-picker :show="isShowcardValidity" ref="uPicker" :columns="validityPeriodcq"
- @confirm="confirmValidityPeriodcq" @change="changeHandler" @close='isShowcardValidity=false'
- @cancel='isShowcardValidity=false' :closeOnClickOverlay='true'>
- </u-picker>
- </view>
- <view class="submit" @click="submit">立即发布</view>
- <u-picker :show="isShowValidity" ref="uPicker" :columns="validityPeriod" @confirm="confirmValidityPeriod"
- :closeOnClickOverlay='true' @close='isShowValidity=false' @cancel='isShowValidity=false'>
- </u-picker>
- <u-toast ref="uToast"></u-toast>
- </view>
- </template>
- <script>
- var _this;
- import {
- mapState
- } from 'vuex';
- export default {
- data() {
- return {
- radioCustomStyle: {
- margin: '0 0 0 20rpx'
- },
- show: false,
- columns: [
- ['个人货主', '黑龙江中天昊元贸易有限公司', '黑龙江利润元贸易有限公司']
- ],
- dataObj: {
- commonId: '',
- cargoOwner: '',
- sendPrivate: '',
- sendCity: '',
- sendArea: '',
- sendDetailedAddress: '',
- unloadPrivate: '',
- unloadCity: '',
- unloadArea: '',
- unloadDetailedAddress: '',
- distance: '',
- goodsName: '',
- billingMethod: '元/吨',
- freightPrice: '',
- freightAdvance: true,
- sender: '',
- senderPhone: '',
- receiver: '',
- receiverPhone: '',
- weight: '',
- loadingDateStart: '',
- loadingDateEnd: '',
- carLengthSmall: '',
- carLength: '',
- loadWeightSmall: '',
- loadWeight: '',
- carModel: '',
- taskDescription: '',
- taskValidity: '',
- sendLongitude: '',
- sendLatitude: '',
- unsendLongitude: '',
- unsendLatitude: '',
- },
- checkboxValue1: [],
- checkboxList1: [{
- name: '不限',
- disabled: false
- },
- {
- name: '高栏',
- disabled: false
- },
- {
- name: '集装箱',
- disabled: false
- },
- {
- name: '自卸车',
- disabled: false
- }
- ],
- value: true,
- isShowcardValidity: false,
- ValidityPeriodType: '',
- validityPeriod: [],
- validityPeriodcq: [],
- isShowValidity: false,
- radiolist1: [{
- name: '元/吨',
- disabled: false
- },
- {
- name: '元/车',
- disabled: false
- },
- ],
- }
- },
- onShow() {
- // //获取默认收货、发货地
- // let _faddress = uni.getStorageSync('storage_faddress');
- // let _saddress = uni.getStorageSync('storage_saddress');
- // if (_faddress) {
- // this.dataObj.sendCity = _faddress.city
- // this.dataObj.sendArea = _faddress.area
- // this.dataObj.sendPrivate = _faddress.province
- // this.dataObj.sendDetailedAddress = _faddress.detailedAddress
- // this.dataObj.sendLongitude = _faddress.longitude
- // this.dataObj.sendLatitude = _faddress.latitude
- // }
- // if (_saddress) {
- // this.dataObj.unloadDetailedAddress = _saddress.detailedAddress
- // this.dataObj.unloadCity = _saddress.city
- // this.dataObj.unloadArea = _saddress.area
- // this.dataObj.unloadPrivate = _saddress.province
- // this.dataObj.unsendLongitude = _saddress.longitude
- // this.dataObj.unsendLatitude = _saddress.latitude
- // }
- },
- onLoad(options) {
-
- _this = this;
- this.dataObj = options
- if (this.dataObj.billingMethod == 1) {
- this.dataObj.billingMethod = '元/车'
- } else {
- this.dataObj.billingMethod = '元/吨'
- }
- for (let i = 0; i < this.dataObj.carModel.length; i++) {
- if (this.dataObj.carModel[i] == '1') {
- this.checkboxValue1.push('不限')
- } else if (this.dataObj.carModel[i] == '2') {
- this.checkboxValue1.push('高栏')
- } else if (this.dataObj.carModel[i] == '3') {
- this.checkboxValue1.push('集装箱')
- } else if (this.dataObj.carModel[i] == '4') {
- this.checkboxValue1.push('自卸车')
- }
- }
- if (this.dataObj.freightAdvance) {
- this.dataObj.freightAdvance = true
- } else {
- this.dataObj.freightAdvance = false
- }
- console.log(this.dataObj)
- this.validityPeriod = this.$helper.makeValidityPeriod(0, '随时')
- this.validityPeriodcq = this.$helper.makeValidityPeriod(0, '随时')
- },
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- methods: {
- changeHandler(e) {
- const {
- columnIndex,
- value,
- values,
- index,
- picker = this.$refs.uPicker
- } = e
- // if (columnIndex === 0) {
- //
- // if (e.index != 0) {
- // picker.setColumnValues(1, this.validityPeriod[1].shift())
- // }
- // } else if (columnIndex === 1) {
- // if (e.index != 0) {
- // picker.setColumnValues(2, this.validityPeriod[2].shift())
- // }
- // }
- },
- selectCargoOwnerClose() {
- this.show = false
- },
- confirmSelectCargoOwner(e) {
-
- this.dataObj.cargoOwner = e.value[0]
- this.show = false
- },
- selectCargoOwner() {
- this.show = true
- },
- selectAddress(type) {
- uni.$u.route('/pages/release/selectAddress', {
- type: type,
- });
- },
- checkboxChange(n) {
- console.log('change', n);
- },
- selectValidityPeriodcq() {
- this.isShowcardValidity = true
- },
- confirmValidityPeriod(e) {
- console.log('confirm', e)
- if (!e.value[1] || !e.value[2]) {
- this.$refs.uToast.show({
- type: 'error',
- message: "日期格式错误,请重新选择!",
- })
- return
- }
- switch (this.ValidityPeriodType) {
- case 0:
- this.dataObj.loadingDateStart = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
- break
- case 1:
- this.dataObj.loadingDateEnd = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
- break
- }
- this.isShowValidity = false
- },
- confirmValidityPeriodcq(e) {
- console.log('confirm', e)
- this.dataObj.taskValidity = e.value[0] + '-' + e.value[1] + '-' + e.value[2]
- this.isShowcardValidity = false
- },
- selectValidityPeriod(type) {
- this.ValidityPeriodType = type
- this.isShowValidity = true
- },
- change(e) {
- console.log('change', e);
- },
- back() {
- uni.navigateBack()
- },
- goToRecord() {
- uni.$u.route('/pages/release/record');
- },
- radioChange(n) {
- console.log('radioChange', n);
- this.dataDetails.type = n
- },
- submit() {
-
- uni.showLoading({
- mask: true,
- title: '加载中...'
- })
- // 校验没写
- if (this.dataObj.billingMethod == '元/吨') {
- this.dataObj.billingMethod = 0
- } else {
- this.dataObj.billingMethod = 1
- }
- if (this.dataObj.freightAdvance) {
- this.dataObj.freightAdvance = 1
- } else {
- this.dataObj.freightAdvance = 0
- }
- let _list = []
- for (let i = 0; i < this.checkboxValue1.length; i++) {
- if (this.checkboxValue1 == '不限') {
- _list.push(1)
- } else if (this.checkboxValue1 == '高栏') {
- _list.push(2)
- } else if (this.checkboxValue1 == '集装箱') {
- _list.push(3)
- } else if (this.checkboxValue1 == '自卸车') {
- _list.push(4)
- }
- }
- this.dataObj.carModel = _list.toString()
- this.dataObj.commonId = this.userInfo.id
- this.$request.baseRequest('post', '/publishTaskInfo/api/editTask', this.dataObj).then(res => {
-
- uni.hideLoading()
- this.$refs.uToast.show({
- type: 'success',
- message: "发布成功",
- complete() {
- this.dataObj = {}
- uni.$u.route('/pages/release/record');
- }
- })
- })
- .catch(res => {
- uni.showToast({
- title: res.message,
- icon: 'none',
- duration: 2000
- })
- });
- },
- }
- }
- </script>
- <style scoped lang="scss">
- .input {
- text-align: right;
- }
- .title {
- padding: 0 20rpx;
- display: flex;
- justify-content: center;
- position: relative;
- .nav-title {
- font-size: 32rpx;
- }
- .back {
- position: absolute;
- left: 20rpx;
- }
- .search {
- display: flex;
- align-items: center;
- position: absolute;
- right: 20rpx;
- }
- }
- .fixed1 {
- height: var(--status-bar-height);
- }
- .row {
- display: flex;
- justify-content: space-between;
- }
- .content1 {
- background: white;
- margin: var(--status-bar-height) 20rpx 0 20rpx;
- border-radius: 20rpx;
- padding: 40rpx;
- .select-sf {
- color: #999999;
- }
- .right {
- color: #CBCBCB
- }
- }
- .content2,
- .content3,
- .content5 {
- box-sizing: border-box;
- background: white;
- border-radius: 20rpx;
- padding: 20rpx;
- margin: 20rpx;
- .row {
- margin: 30rpx;
- }
- .row1,
- .row2 {
- display: flex;
- justify-content: space-between;
- align-items: center;
- .left .top {
- display: flex;
- }
- }
- }
- .select-type {
- display: flex;
- justify-content: flex-end;
- }
- .content2 {
- padding: 40rpx;
- .row1,
- .row2 {
- .left {
- width: 100%;
- }
- .right {
- color: #CBCBCB
- }
- }
- .row2 {
- margin-top: 40rpx;
- }
- .top {
- display: flex;
- align-items: center;
- }
- .bottom {
- margin-top: 10rpx;
- padding-left: 72rpx;
- }
- .title {
- font-size: 36rpx;
- font-weight: 700;
- color: #171717;
- }
- .collect {
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- background: #2772FB;
- color: white;
- padding: 6rpx;
- border-radius: 50%;
- text-align: center;
- }
- .send {
- width: 40rpx;
- height: 40rpx;
- line-height: 40rpx;
- background: #101010;
- color: white;
- padding: 6rpx;
- border-radius: 50%;
- text-align: center;
- }
- }
- .content3 {}
- .content4 {
- margin: 20rpx;
- padding-left: 20rpx;
- .title {
- color: #999999;
- }
- .btn-text {
- color: #2772FB;
- border: 1px solid #2772FB;
- border-radius: 40rpx;
- padding: 0rpx 10rpx;
- box-sizing: border-box;
- }
- }
- .submit {
- width: 90%;
- margin: 100rpx auto;
- font-size: 36rpx;
- font-weight: 500;
- color: #FFFFFF;
- background: #2772FB;
- text-align: center;
- padding: 20rpx 0;
- border-radius: 50rpx;
- }
- .select-data {
- color: #999999;
- }
- .row-bgc {
- background: #F7F8FA;
- padding: 20rpx 30rpx;
- box-sizing: border-box;
- border-radius: 10rpx;
- }
- .car-input {
- // padding:20rpx;
- // box-sizing: border-box;
- // border-radius: 10px;
- }
- .car-line {
- margin: 0 20rpx;
- }
- .car-row {
- display: flex;
- background: white;
- padding: 20rpx;
- box-sizing: border-box;
- border-radius: 10rpx;
- }
- </style>
|