123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160 |
- <template>
- <view class="wrap">
-
- <view class="content content1" v-for="(item,index) in dataList" :key="index">
- <view class="top">
- <view>{{item.warehouseName}}</view>
- <view>{{item.validityDate}}前有效</view>
- </view>
- <view>{{item.shipperName}}({{item.carList.length}}车)</view>
- <view class="car-list">
- <view v-for="(item1,index) in item.carList">
- {{item1}}
- </view>
- </view>
- <u-button @click='del(item)'>删除</u-button>
- </view>
- <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>
- <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>
- </view>
- </template>
- <script>
- import {
- mapState
- } from 'vuex';
- export default {
- components: {
- },
- data() {
- return {
- id:'',
- warehouseName:'',
- isShowAlert: false,
- isShowAlert1:false,
- content: '当前登入信息验证失败,是否重新登录?',
- content1: '确定删除送粮记录?',
- dataList:[]
- }
- },
- onLoad() {
- },
- // #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;
- }
- let _obj = {
- commonId:uni.getStorageSync("userInfo").id,
- pageSize:10,
- currentPage:1
-
- }
- this.$api.doRequest('get', '/grainDeliveryRegistration/selectGrainDeliveryRegistration',_obj ).then(res => {
- if (res.data.code == 200) {
- this.dataList = []
- debugger
- for(let i = 0;i<res.data.data.records.length;i++){
- let _data = res.data.data.records[i];
- let _carNumberList = _data.carNo.split(',')
- let __obj = {
- warehouseName:_data.warehouseName,
- id:_data.id,
- shipperName:_data.shipperName,
- carList:_carNumberList,
- validityDate:_data.validityDate
-
- }
- this.dataList.push(__obj)
- }
- }
- })
-
- })
- console.log("hasLogin", this.hasLogin)
- },
- methods: {
- del(row){
- this.isShowAlert1=true
- this.id = row.id
- // 删除成功后删除页面当前行
-
-
-
- },
-
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- }
- uni.navigateTo({
- url
- })
- },
- alertBtn() {debugger
- this.$api.doRequest('post', '/grainDeliveryRegistration/api/deleteInfo',{
- id:this.id
- }).then(res => {
- if (res.data.code == 200) {
- for(let i=0;i<this.dataList.length;i++){
- if(this.id==this.dataList[i].id){
- this.dataList.splice(i,1)
- }
- }
- }
- })
-
- },
- cancelClick() {
- this.isShowAlert = false
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- page {
- background: #F5F6FA;
- }
- .wrap {
- background: #fff;
- margin: 10px;
- border-radius: 10px;
- padding: 10px;
- }
- .top{
- display: flex;
- justify-content: space-between;
- }
- </style>
|