123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256 |
- <template>
- <view class="">
- <view class="content1">
- <view>{{dataList.warehouseName}}</view>
- <view class="row2">
- <view class='locationwrap'>
- <image class='location' src="../../../static/img/liangmai/icon_ditu@2x.png" mode=""></image>
- {{warehouseNameAddress}}
- </view>
- </view>
- <view class="row3">
- <view>{{startDate}}创建(有效期{{dataList.validityDate}})</view>
- </view>
- </view>
- <view class="content2">
- <view class="title">送货信息</view>
- <view class="wrap wrap1" v-for="(item,index) in dataList.shippingInformationList" :key='index'>
- <view class="row1">
- <view class="left">
- <view>货主{{index+1}}-{{item.customerName}}</view>
- <view @click="reduceBtn(index)">--</view>
- </view>
- <view class="right" @click='showCustomerName(item)'>
- <view>{{item.customerName}}</view>
- <u-icon name="arrow-right" color=""></u-icon>
- <u-picker @confirm="nameConfirm" range-key='customerName' mode="selector"
- v-model="item.showCustomerName" :range="nameList"></u-picker>
- </view>
- </view>
- <view class="row2">
- <view class="left">
- 供应商(送粮人)
- </view>
- <view class="right">{{item.supplier}}</view>
- </view>
- <view class="row2" v-for="(item1,index1) in item.carNumberList" :key='index1'>
- <view class="left">
- 车牌号-{{index1+1}}
- </view>
- <u-input v-model="item1.carNo" placeholder="输入7为车牌号" />
- <view>
- <view @click="addCarNumber(item.carNumberList)">+</view>
- <view @click="delCarNumber(item.carNumberList,index1)">-</view>
- </view>
- </view>
- </view>
- <u-button @click='addGoodPeople'>增加货主</u-button>
- </view>
- <u-button @click='submit'>提交</u-button>
- <u-modal v-model="isShowAlert" :title-style="{fontSize: '18px',fontWeight:'500'}"
- :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='登录提示'
- showCancelButton='false' :content="content" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
- <u-modal v-model="isShowAlert1" :title-style="{fontSize: '18px',fontWeight:'500'}"
- :content-style="{fontSize: '14px',fontWeight:'400'}" confirm-color='#22C572' confirm-text='确定' title='登录提示'
- showCancelButton='false' :content="content1" @confirm="alertBtn" @cancel="cancelClick"></u-modal>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- components: {
- },
- data() {
- return {
- isShowAlert: false,
- isShowAlert1: false,
- content: '当前登入信息验证失败,是否重新登录?',
- content1: '确定提交送粮信息?',
- // show: false,
- show1: false,
- cargoOwner: [{
- name: '123'
- }],
- nameList: [],
- warehouseNameAddress: '',
- startDate: "",
- dataList: {
- warehouseName: "",
- validityDate: '',
- commonId: uni.getStorageSync("userInfo").id,
- shippingInformationList: [{
- shipperName: '',
- supplier: '',
- carNo: '',
- carNumberList: [{
- carNo: ''
- }]
- }]
- }
- }
- },
- onLoad(options) {
- debugger
- // let _pageToData = JSON.parse(options.itemValue)
- // this.dataList.warehouseName = _pageToData.warehouseName
- // this.startDate = this.getTime()[0]
- // this.dataList.validityDate = this.getTime()[1]
- // this.warehouseNameAddress = _pageToData.warehousePrivate + _pageToData.warehouseCity + _pageToData
- // .warehouseArea + _pageToData.detailedAddress
- },
- // #ifndef MP
- onNavigationBarButtonTap(e) {
- const index = e.index;
- if (index === 0) {
- this.navTo('/pages/set/set');
- } else if (index === 1) {
- // #ifdef APP-PLUS
- const pages = getCurrentPages();
- const page = pages[pages.length - 1];
- const currentWebview = page.$getAppWebview();
- currentWebview.hideTitleNViewButtonRedDot({
- index
- });
- // #endif
- uni.navigateTo({
- url: '/pages/notice/notice'
- })
- }
- },
- // #endif
- computed: {
- ...mapState(['hasLogin', 'userInfo']),
- },
- onShow() {
- this.$api.doRequest('get', '/commonUser/api/checkSession').then(res => {
- console.log("checkSession", res)
- if (res.data.data == "INVALID") {
- this.isShowAlert = true;
- }
- this.getCustomer()
- })
- console.log("hasLogin", this.hasLogin)
- },
- methods: {
- showCustomerName(value) {debugger
- for(let i = 0;i<this.dataList.shippingInformationList.length;i++){
- this.dataList.shippingInformationList[i].showCustomerName = false
- }
- value.showCustomerName = true
- },
- getCustomer() {
- let _data = {
- commonId: uni.getStorageSync("userInfo").id,
- }
- this.$api.doRequest('get', '/identityAuthenticationInfo/identityAuthenticationInfoUser', _data).then(
- res => {
- if (res.data.code == 200) {
- // debugger
- this.nameList = res.data.data
- // for (let i = 0; i < this.nameList.length; i++) {
- // this.nameList[i].showCustomerName = false
- // }
- this.customerName = res.data.data[0].customerName
- }
- })
- },
- getTime() {
- let _startTime = new Date().format("yyyy-MM-dd");
- var _endTime = new Date();
- _endTime.setDate(_endTime.getDate() + 2);
- _endTime = _endTime.format("yyyy-MM-dd");
- return [_startTime, _endTime]
- },
- reduceBtn(index) {
- if (this.dataList.shippingInformationList.length > 1) {
- this.dataList.shippingInformationList.splice(index, 1)
- this.$forceUpdate()
- }
- },
- submit() {
- this.isShowAlert1 = true
- },
- nameConfirm() {},
- /**
- * 统一跳转接口,拦截未登录路由
- * navigator标签现在默认没有转场动画,所以用view
- */
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- }
- uni.navigateTo({
- url
- })
- },
- alertBtn() {
- for (let i = 0; i < this.dataList.shippingInformationList.length; i++) {
- delete this.dataList.shippingInformationList[i].carNumberList
- }
- this.$api.doRequest('post', '/grainDeliveryRegistration/api/insertInfo', this.dataList).then(res => {
- if (res.data.code == 200) {
- }
- })
- },
- cancelClick() {
- this.isShowAlert = false
- this.isShowAlert1 = false
- },
- addGoodPeople() {
- this.dataList.shippingInformationList.push({
- shipperName: '',
- supplier: '',
- carNo: '',
- carNumberList: [{
- carNo: ''
- }]
- })
- },
- addCarNumber(val) {
- val.push({
- carNo: ''
- })
- },
- delCarNumber(val, index) {
- if (val.length > 1) {
- val.splice(index, 1)
- this.$forceUpdate()
- }
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- page {
- background: #F5F6FA;
- }
- .wrap {
- background: #fff;
- margin: 10px;
- border-radius: 10px;
- padding: 10px;
- }
- .location {
- width: 32rpx;
- height: 32rpx;
- margin-right: 10rpx;
- }
- .locationwrap {
- font-size: 16px;
- display: flex;
- align-items: center;
- }
- </style>
|