记录一个简单的vue页面实现

<template>
  <div class="userView">
    <!-- 页眉颜色统一 -->
    <div class="buttonTop"></div>
    <div class="main">
      <!--工具栏-->
      <div class="center" style="overflow: hidden;">
        <el-button @click="updateOrderInvoiceBatch" type="success">批量设置拣货中</el-button>
        <div class="input" style="float:right">
          <span>发货单状态:</span>
          <el-select clearable style="width:100px;" v-model="data.sts" placeholder="发货单状态" size="small">
            <el-option label="取消" value="0"></el-option>
            <el-option label="未支付" value="1"></el-option>
            <el-option label="已支付" value="2"></el-option>
            <el-option label="拣货中" value="3"></el-option>
            <el-option label="已发货" value="4"></el-option>
          </el-select>
          <el-input placeholder="请输入名称" v-model="data.name" clearable size="small"></el-input>
          <el-button @click="select" type="success">检索</el-button>
          <el-button @click="emptyData"  type="info">清空</el-button>
        </div>
      </div>

      <!--列表table展示-->
      <el-table
        :data="orderInvoiceList.rows"
        @selection-change="changeTable"
        border
        style="width: 100%; margin-top: 10px">
        <el-table-column type="selection" min-width="35"></el-table-column>
        <el-table-column prop="price" label="货价" min-width="50"></el-table-column>
        <el-table-column prop="postFee" label="运费"  min-width="50"></el-table-column>
        <el-table-column prop="totalPrice" label="总价"  min-width="50"></el-table-column>
        <el-table-column prop="isCanceled" label="是否取消"  min-width="60" :formatter="booleanMsgFun"></el-table-column>
        <el-table-column prop="isSettled" label="费用是否结清"  min-width="80" :formatter="booleanMsgFun"></el-table-column>
        <el-table-column prop="isSettledFee" label="运费是否结清"  min-width="80" :formatter="booleanMsgFun"></el-table-column>
        <el-table-column prop="isPost" label="是否发货"  min-width="60" :formatter="booleanMsgFun"></el-table-column>
        <el-table-column prop="customerAddress" label="地址"  min-width="220"></el-table-column>
        <el-table-column prop="customerPhone" label="电话"  min-width="85"></el-table-column>
        <el-table-column prop="customerName" label="名称"  min-width="60"></el-table-column>
        <el-table-column prop="waybillNo" label="运单号"  min-width="110"></el-table-column>
        <el-table-column prop="carrier" label="承运人"  min-width="60"></el-table-column>
        <el-table-column prop="startPickTime" label="开始拣货时间"  min-width="100"></el-table-column>
        <el-table-column prop="postTime" label="发货时间"  min-width="100"></el-table-column>
        <el-table-column label="操作"  min-width="60">
          <template slot-scope="scope">
            <el-button size="mini" @click.native="editOrderInvoice(scope.$index, scope.row)">发货</el-button>
            <el-button
              size="mini"
              type="danger"
              @click="updateOrderInvoice(scope.$index,scope.row)">拣货中</el-button>
          </template>
        </el-table-column>
      </el-table>

      <!-- 分页 -->
      <div class="page">
        <el-pagination
          :background="true"
          @size-change="handleSizeChange"
          @current-change="handleCurrentChange"
          :current-page="page"
          :page-sizes="[10, 20, 30, 40 , 50, 100]"
          :page-size="rows"
          layout="total, sizes, prev, pager, next, jumper"
          :total="orderInvoiceList.total">
        </el-pagination>
      </div>

      <!-- 编辑dialog对象 -->
      <el-dialog  :visible.sync="dialogVisible" :close-on-click-modal="false" size="tiny">
            <span slot="title"  class="el-dialog__title">
                  {{‘发货‘}}
            </span>
        <el-form ref="dialogData" :model="dialogData" label-width="150px">
         <!-- <el-form-item label="地址">
              <el-input v-model="dialogData.customerAddress"></el-input>
          </el-form-item>
          <el-form-item label="电话" >
            <el-input v-model="dialogData.customerPhone"></el-input>
          </el-form-item>
          <el-form-item label="姓名">
            <el-input v-model="dialogData.customerName"></el-input>
          </el-form-item>-->
          <el-form-item label="运单号">
            <el-input v-model="dialogData.waybillNo"></el-input>
          </el-form-item>
          <el-form-item label="承运人">
            <el-input v-model="dialogData.carrier"></el-input>
          </el-form-item>
          <!--<el-form-item label="开始拣货时间" >
            <el-col :span="10">
              <el-date-picker type="datetime" placeholder="选择时间" v-model="dialogData.startPickTime" style="width: 100%;"></el-date-picker>
            </el-col>
          </el-form-item>
          <el-form-item label="发货时间" >
            <el-col :span="10">
              <el-date-picker type="datetime" placeholder="选择时间" v-model="dialogData.postTime" style="width: 100%;"></el-date-picker>
            </el-col>
          </el-form-item>
          <el-form-item label="是否取消" label-width="150px">
            <el-col :span="4">
              <el-switch
                v-model="canceled"
                on-color="#13ce66"
                on-text="是"
                off-text="否"
                off-color="#666666"
                @change=‘changeIsCanceledStatus($event)‘>
              </el-switch>
            </el-col>
          </el-form-item>
          <el-form-item label="费用是否结清" label-width="150px">
            <el-col :span="4">
              <el-switch
                v-model="settled"
                on-color="#13ce66"
                on-text="是"
                off-text="否"
                off-color="#666666"
                @change=‘changeIsSettledStatus($event)‘>
              </el-switch>
            </el-col>
          </el-form-item>
          <el-form-item label="运费是否结清" label-width="150px">
            <el-col :span="4">
              <el-switch
                v-model="settledFee"
                on-color="#13ce66"
                on-text="是"
                off-text="否"
                off-color="#666666"
                @change=‘changeIsSettledFeeStatus($event)‘>
              </el-switch>
            </el-col>
          </el-form-item>
          <el-form-item label="是否发货" label-width="150px">
            <el-col :span="4">
              <el-switch
                v-model="post"
                on-color="#13ce66"
                on-text="是"
                off-text="否"
                off-color="#666666"
                @change=‘changeIsPostStatus($event)‘>
              </el-switch>
            </el-col>
          </el-form-item>-->
        </el-form>
        <div slot="footer" class="dialog-footer">
          <el-button @click.native="editOrderInvoiceSubmit">保存并关闭</el-button>
          <el-button @click.native="dialogVisible = false">取消</el-button>
        </div>
      </el-dialog>

    </div>
  </div>
</template>

<script>
  import util from ‘../../common/js/util‘
  import NProgress from ‘nprogress‘
  import http from ‘../../api/http‘

  export default {
    data(){
      return{
        page:1,
        rows:10,
        data:{
          id:"",
          name:"",
          sts:null
        },
        // 弹出框的数据
        dialogData:{
          id:‘‘,
          /*customerAddress:‘‘,
          customerPhone:‘‘,
          customerName:‘‘,*/
          waybillNo:‘‘,
          carrier:‘‘,
         /* startPickTime:"",
          postTime:"",
          canceled:false,
          settled:false,
          settledFee:false,
          post:false*/
        },
        multipleSelection:[],
        orderInvoiceList:{},
        /*canceled:false,
        settled:false,
        settledFee:false,
        post:false,*/
        dialogVisible: false
      }
    },
    methods:{
      loadOrderInvoiceList(){
        let obj = {
          page : this.page,
          rows : this.rows,
          name : this.data.name,
          sts : this.data.sts
        }
        this.apiPost(‘/order/invoiceList‘,obj).then(res=>{
          this.handelResponse(res, (data) => {
            this.orderInvoiceList = data
          })
        })
      },
      handleSizeChange(val) {
        this.rows = val
        this.loadOrderInvoiceList();
      },
      handleCurrentChange(val) {
        this.page = val;
        this.loadOrderInvoiceList();
      },
      clearable(){
        this.data.name = ‘‘;
        this.data.sts = null;
        this.loadOrderInvoiceList();
      },
      changeTable(val){
        this.multipleSelection = val;
      },
      // 检索
      select(){
        this.loadOrderInvoiceList()
      },
      //清空按钮操作
      emptyData(){
        this.data.name = "";
        this.data.sts = null;
        this.select()
      },
      //布尔类型数据格式化显示
      booleanMsgFun(row, column,value){
          if(value){
              return "是";
          }else{
              return "否";
          }
      },
      //主要功能打开编辑页面,回显当前行信息,包括图片
      editOrderInvoice(index,row) {
        this.apiPost(‘/order/orderInvoice/‘+row.id+‘/get‘,{}).then((res) => {
          this.handelResponse(res, (data) => {
            this.dialogData=data
            /*if(data.startPickTime){
              this.dialogData.startPickTime=new Date(data.startPickTime);
            }else{
              this.dialogData.startPickTime=null;
            }
            if(data.postTime){
              this.dialogData.postTime=new Date(data.postTime);
            }else{
              this.dialogData.postTime=null;
            }
            this.canceled=data.isCanceled;
            this.settled=data.isSettled;
            this.settledFee=data.isSettledFee;
            this.post=data.isPost;*/
            this.dialogVisible=true;
          })
        });
      },
      //发货单编辑页面的保存方法
      editOrderInvoiceSubmit() {
        /*this.dialogData.canceled=this.canceled;
        this.dialogData.settled=this.settled;
        this.dialogData.settledFee=this.settledFee;
        this.dialogData.post=this.post;*/
        this.apiPost(‘/order/orderInvoice/‘+this.dialogData.id+‘/updateIsPost‘,this.dialogData).then((res) => {
          this.handelResponse(res, (data) => {
            this.dialogVisible=false;
            _g.toastMsg(‘success‘,‘提交成功‘);
            this.loadOrderInvoiceList();
          })
        });
      },
      //清空表单的回显值问题
      newData(){
        this.dialogData.id="",
        /*this.dialogData.customerAddress="",
        this.dialogData.customerPhone="",
        this.dialogData.customerName="",*/
        this.dialogData.waybillNo="",
        this.dialogData.carrier=""
        /*this.dialogData.startPickTime=null,
        this.dialogData.postTime=null,
        this.dialogData.canceled=false,
        this.dialogData.settled=false,
        this.dialogData.settledFee=false,
        this.dialogData.post=false*/
      },
      /*changeIsCanceledStatus($event){
        this.canceled=$event;
      },
      changeIsSettledStatus($event){
        this.settled=$event;
      },
      changeIsSettledFeeStatus($event){
        this.settledFee=$event;
      },
      changeIsPostStatus($event){
        this.post=$event;
      }*/
      //修改当前记录状态为拣货中
      updateOrderInvoice(index,row) {
        this.$confirm(‘确认修改当前选中记录状态为拣货中吗?‘, ‘提示‘, {
          type: ‘warning‘
        }).then(() => {
          this.apiPost(‘/order/orderInvoice/‘+row.id+‘/updateStartPick‘,{}).then((res) => {
            this.handelResponse(res, (data) => {
              _g.toastMsg(‘success‘,‘修改成功‘);
              this.loadOrderInvoiceList();
            })
          });
        }).catch(() => {
        });
      },
      //批量修改当前记录状态为拣货中
      updateOrderInvoiceBatch(){
        if(this.multipleSelection.length == 0){
          this.$message.error(‘请至少选中一行数据‘);
          return
        }
        let id = []
        for(let i = 0;i < this.multipleSelection.length;i ++){
          id[i] = this.multipleSelection[i].id
        }
        let obj = {
          ids : id
        }
        console.log("aaabbb:"+JSON.stringify(obj));
        this.$confirm(‘确认修改当前选中记录状态为拣货中吗?‘, ‘提示‘, {
          type: ‘warning‘
        }).then(() => {
          this.apiPost(‘/order/orderInvoice/updateStartPickBatch‘,obj).then(res=>{
            this.handelResponse(res, (data) => {
              _g.toastMsg(‘success‘,‘修改成功‘);
              this.loadOrderInvoiceList();
            })
          });
        }).catch(() => {
        });
      },
    },
    mounted(){
      this.loadOrderInvoiceList();
    },
    mixins: [http],
  }
</script>

<style lang="scss" scoped>
  .userView{
    .buttonTop{
      padding: 6px 10px 0;
      background: #545c64;
      height: 56px;
      overflow: hidden;
      border-bottom: 1px solid rgb(255, 208, 75);
      color: #fff;
    }
    .main{
      padding: 0 15px;
    .center{
      margin-top: 10px;
      margin-bottom: 20px;
    }
    }
    .input{
      float: left;
      margin: 8px 0;
      margin-right: 32px;
    }
  }
  .page {
    /* width: 600px; */
    margin: 10px auto 10px;
  }
</style>

原文地址:https://www.cnblogs.com/mr-wuxiansheng/p/8861995.html

时间: 2024-10-09 20:38:21

记录一个简单的vue页面实现的相关文章

第十篇 编写一个简单的注册页面

一个简单的注册页面 今天的课程学习,我们来一波综合,将前面学到的东西,做一次小练习,我们自定义一个注册页面,不需要太华丽,能表达清楚意思就可以了. <!DOCTYPE html> <html> <head lang="en"> <!--支持中文字符集--> <meta charset="UTF-8"> <!--标题--> <title>注册</title> <!--

JavaScript之实现一个简单的Vue

vue的使用相信大家都很熟练了,使用起来简单.但是大部分人不知道其内部的原理是怎么样的,今天我们就来一起实现一个简单的vue. Object.defineProperty() 实现之前我们得先看一下Object.defineProperty的实现,因为vue主要是通过数据劫持来实现的,通过get.set来完成数据的读取和更新. var obj = {name:'wclimb'}var age = 24Object.defineProperty(obj,'age',{enumerable: tru

ASP.NET Aries 入门开发教程2:配置出一个简单的列表页面

前言: 朋友们都期待我稳定地工作,但创业公司若要躺下,也非意念可控. 若人生注定了风雨飘摇,那就雨中前行了. 最机开始看聊新的工作机会,欢迎推荐,创业公司也可! 同时,趁着自由时间,抓紧把这系列教程给写完了. 谢谢大伙的关注和支持. 步骤1:准备好数据库和表(或视图) 由于框架支持跨数据库,所以可以先不用管系统权限的那个数据库,先随意找个数据库. 当然你也可以找个视图(只是视图就不能编辑或删除[权限控制]) 步骤2:配置数据库链接: 以数据库名+Conn 为name(这是跨库的约定,不要乱取).

理解vue实现原理,实现一个简单的Vue框架

参考: 剖析Vue实现原理 - 如何实现双向绑定mvvm Vue.js源码(1):Hello World的背后 Vue.js官方工程 本文所有代码可以在git上找到. 其实对JS我研究不是太深,用过很多次,但只是实现功能就算了.最近JS实在是太火,从前端到后端,应用越来越广泛,各种框架层出不穷,忍不住也想赶一下潮流. Vue是近年出的一个前端构建数据驱动的web界面的库,主要的特色是响应式的数据绑定,区别于以往的命令式用法.也就是在var a=1;的过程中,拦截'='的过程,从而实现更新数据,w

记录一个简单webapi 上传图片

图片转base64字符串,到接口后,再转回保存.代码里面是转成byte[]之后转的,也可以用base64字符串直接转图片. 只想记录一下简单的流程. 1,服务端 保存图片业务代码: public class UpLoadFile    {        public string UpLoad(string fileName,string filePath,byte[] fileData)        {            Bitmap map =BitmapFromBytes(fileD

记录一个简单的HttpClient抓取页面内容

现如今的网络时代,HTTP协议如此重要,随着java的发展,也越来越多的人采用java直接通过HTTP协议访问网络资源,虽然java.net提供了基本的访问HTTP协议的基本功能,但是对于大部分应用程序来说,仍旧还有许多功能不能够灵活使用:HttpClient是Apache Jakarta Common 下的子项目,一个提供访问HTTP协议的java工具包,提供了更多.更快捷.丰富的方法,HttpClient主要常用的功能有:实现了所有 HTTP 的方法(GET,POST,PUT,HEAD,DE

用HTML5写一个简单的HTML页面

HTML5的<!doctype>声明 在HTML 4.01中doctype这样写: <!DOCTYPE html PUBLIC "-//W3C/DTD HTML 4.01//EN""http://www.w3.org/TR/html4/strict.dtd"> 在HTML5中很简单: <!DOCTYPE html> HTML5的<meta>标签 <meta>标签在 HTML 4.01 中这样写: <m

用jQuery Mobile搭建一个简单的手机页面

1.新增html页面. 2.声明html5Document. 3.载入jQuery Mobile Css.jQuery与jQuery Mobile链接库. 4.使用jQuery Mobile定义的html标准.编写网页架构及内容. 向网页中添加jQuery Mobile,添加方法如下: 从CDN引用jQuery Mobile(推荐) <link rel="stylesheet" href="http://code.jquery.com/mobile/1.3.2/jque

php学习,一个简单的Calendar(2) 一个简单的活动页面

有了前面的基础,后面就是将页面展示出来. 预览图如下:1号和31号分别有活动,会一并显示出来   这里需要搞定几个问题,一个就是数据库的连接,我们用\sys\class\class.db_connect.inc.php <?php   /* * 数据库操作(数据库访问,认证等) */   class DB_Connect { /** * Stores a database object * * @var object A database object */ protected $db;   /