123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287 |
- <template>
- <mescroll-body ref="mescrollRef" @init="mescrollInit" :down="downOption" @down="downCallback" @up="upCallback">
- <view class="content">
- <view class="content1" v-for="(item,index) in dataList" :key="index">
- <view class="top">
- <view class="left">{{item.warehouseName}}</view>
- <view class="right">{{item.validityDate}}</view>
- </view>
- <view v-for="(item1,index) in item.shippingInformationList">
- <view class="hz-content">
- <view class="row1">
- <view class="hz-name">
- {{item1.shipperName}}
- </view>
- <view class="car">
- ({{item1.carList.length}}车)
- </view>
- </view>
- <view class="car-list">
- <view v-for="(item2,index) in item1.carList" class="number">
- {{item2}}
- </view>
- </view>
- </view>
- </view>
-
- <view class="del-row">
- <view>{{item.createDate}}</view>
- <view class="del" @click='del(item)'>删除</view>
- </view>
- </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>
- </mescroll-body>
- </template>
- <script>
- import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js";
- import {
- mapState
- } from 'vuex';
- export default {
- mixins: [MescrollMixin], // 使用mixin (在main.js注册全局组件)
- components: {
- },
- data() {
- return {
- downOption: {
- auto: false //是否在初始化后,自动执行downCallback; 默认true
- },
- dataList: [],
- validityDate: '',
- 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;
- }
- })
- console.log("hasLogin", this.hasLogin)
- },
- methods: {
- getData(size, page, type) {
- let _obj = {
- commonId: uni.getStorageSync("userInfo").id
- }
- this.$api.doRequest('get', '/grainDeliveryRegistration/selectGrainDeliveryRegistration', _obj)
- .then(res => {
- if (res.data.code == 200) {
- let curPageData = []
- for (let i = 0; i < res.data.data.length; i++) {
- let _data = res.data.data[i];
- //判断是记录是否失效
- let _isUserd = function() {
- let _startTime = new Date((_data.validityDate + ' 00:00:00')).getTime();
- let _endTime = Date.parse(new Date());
- if (_endTime - _startTime > 0) {
- _data.validityDate = '已失效'
- } else {
- _data.validityDate = _data.validityDate + ' 0时前有效'
- }
- }()
- let _carNumberList=[]
- for (var q = 0; q < _data.shippingInformationList.length; q++) {
- console.log(_data.shippingInformationList[q].carNo.split(','))
- _data.shippingInformationList[q].carList = _data.shippingInformationList[q].carNo.split(',')
- }
- let __obj = {
- warehouseName: _data.warehouseName,
- id: _data.id,
- shipperName: _data.shipperName,
- shippingInformationList: _data.shippingInformationList,
- validityDate: _data.validityDate,
- createDate:_data.createDate
- }
- curPageData.push(__obj)
- }
- if (type == 'down') {
- this.mescroll.endSuccess();
- this.dataList = []
- } else {
- this.mescroll.endBySize(curPageData.length, curPageData.length); //必传参数(当前页的数据个数, 总数据量)
- }
- console.log(curPageData)
- this.dataList = this.dataList.concat(curPageData);
- }
- })
- },
- /*下拉刷新的回调 */
- downCallback() {
- this.getData(10, 1, 'down')
- },
- /*上拉加载的回调: 其中page.num:当前页 从1开始, page.size:每页数据条数,默认10 */
- upCallback(page) {
- //联网加载数据
- this.getData(page.size, page.num, 'up')
- },
- del(row) {
- this.isShowAlert1 = true
- this.id = row.id
- // 删除成功后删除页面当前行
- },
- navTo(url) {
- if (!this.hasLogin) {
- url = '/pages/public/login';
- }
- uni.navigateTo({
- url
- })
- },
- alertBtn() {
- 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.$api.msg('删除成功!')
- this.dataList.splice(i, 1)
- }
- }
- } else {
- this.$api.msg('删除失败!')
- }
- })
- },
- cancelClick() {
- this.isShowAlert = false
- }
- }
- }
- </script>
- <style lang='scss' scoped>
- page {
- background: #F5F6FA;
- }
- .content1 {
- background: white;
- margin: 20rpx;
- padding: 20rpx;
- border-radius: 20rpx;
- .top {
- display: flex;
- justify-content: space-between;
- .left {
- font-size: 32rpx;
- font-weight: 700;
- }
- .right {
- font-size: 28rpx;
- color: #FD714F;
- }
- }
- .hz-content {
- background: #F5F6FA;
- margin-top: 20rpx;
- padding: 20rpx;
- .row1 {
- display: flex;
- align-items: center;
- margin-bottom: 30rpx;
- .hz-name {
- font-size: 36rpx;
- font-weight: 700;
- margin-right: 4rpx;
- }
- .car {
- font-size: 24rpx;
- color: #676E80;
- }
- }
- .car-list {
- .number {
- display: inline-block;
- width: 25%;
- background: #FFFFFF;
- border-radius: 23px;
- font-size: 24rpx;
- color: #676E80;
- padding: 10rpx 20rpx;
- margin: 1%;
- text-align: center;
- box-sizing: border-box;
- }
- }
- }
- .del-row {
- display: flex;
- justify-content: space-between;
- align-items: center;
- margin-top: 20rpx;
- .del {
- background: #FFFFFF;
- border-radius: 33px;
- border: 1px solid #CDCDCD;
- font-size: 28rpx;
- color: #333333;
- margin: 0;
- padding: 10rpx 30rpx;
- height: 100%;
- }
- /deep/.uni-button {}
- }
- }
- </style>
|