batch_send_vue.blade.php 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. @extends('layouts.base')
  2. @section('title','批量发货')
  3. @section('content')
  4. <link rel="stylesheet" type="text/css" href="{{static_url('yunshop/goods/vue-goods1.css')}}"/>
  5. <style>
  6. body{font-weight:500;color:#333;}
  7. .all{background:#eff3f6}
  8. .el-form-item__label{margin-right:30px}
  9. .vue-main-form .el-form-item__content{margin-left:calc(15% + 30px) !important}
  10. .order-sum-li{width:16.66%;line-height:28px}
  11. .list-con-goods-text{min-height:70px;overflow:hidden;flex:1;display: flex;flex-direction: column;justify-content: space-between;}
  12. .list-con-goods-price{border-right:1px solid #e9e9e9;border-left:1px solid #e9e9e9;min-width:150px;min-height:90px;text-align: left;padding:20px;display: flex;flex-direction: column;}
  13. .list-con-goods-title{font-size:14px;line-height:20px;text-overflow: -o-ellipsis-lastline;overflow: hidden;text-overflow: ellipsis;display: -webkit-box;-webkit-line-clamp: 2;line-clamp: 2;-webkit-box-orient: vertical;}
  14. .list-con-goods-option{font-size:12px;color:#999}
  15. </style>
  16. <div class="all">
  17. <div id="app" v-cloak>
  18. <div class="vue-crumbs">
  19. <a>订单管理</a> > 批量发货
  20. </div>
  21. <el-form ref="form" :model="form" label-width="15%">
  22. <div class="vue-head">
  23. <div class="vue-main-title">
  24. <div class="vue-main-title-left"></div>
  25. <div class="vue-main-title-content">批量发货</div>
  26. </div>
  27. </div>
  28. <el-form-item label="选择快递:">
  29. <el-select v-model="form.express" filterable clearable placeholder="选择快递" style="width:500px">
  30. <el-option v-for="(item,index) in list"
  31. :label="item.name"
  32. :value="item"
  33. >
  34. </el-option>
  35. </el-select>
  36. </el-form-item>
  37. <el-form-item label="表格:">
  38. <el-upload
  39. style="width: 300px;"
  40. class="upload-demo"
  41. ref="upload"
  42. action="{!! yzWebFullUrl('order.batch-send.index') !!}"
  43. :on-preview="handlePreview"
  44. :on-remove="handleRemove"
  45. accept=".xlsx,.xls,csv"
  46. :data="upData"
  47. :on-success="success"
  48. {{--:file-list="fileList"--}}
  49. :auto-upload="false">
  50. <el-button slot="trigger" size="small" type="primary">选取文件</el-button>
  51. </el-upload>
  52. <div style="padding-bottom: 15px;">如果遇到数据重复,则进行数据更新!</div>
  53. <el-button style="margin-left: 10px;" size="small" type="success" @click="submitUpload('form')">确认导入</el-button>
  54. <el-button style="margin-left: 10px;" size="small" type="success" @click="getExample">下载表格模板</el-button>
  55. <p style="padding-top: 40px; font-size: 16px; font-weight: bold;">功能介绍:</p>
  56. <span>使用excel快速导入进行订单发货, 文件格式[XLS]</span><br/>
  57. <span>如重复导入数据将以最新导入数据为准,请谨慎使用</span><br/>
  58. <span>数据导入订单状态自动修改为已发货</span><br/>
  59. <span>一次导入的数据不要太多,大量数据请分批导入,建议在服务器负载低的时候进行</span>
  60. <p style="padding-top: 40px; font-size: 16px; font-weight: bold;">使用方法:</p>
  61. <span>1. 下载Excel模板文件并录入信息</span><br/>
  62. <span>2. 选择快递公司</span><br/>
  63. <span>3. 上传Excel导入</span>
  64. <p style="padding-top: 40px; font-size: 16px; font-weight: bold;">格式要求:</p>
  65. <span>Excel第一列必须为订单编号,第二列必须为快递单号,请确认订单编号与快递单号的备注</span>
  66. </el-form-item>
  67. </el-form>
  68. <!-- 导入信息 -->
  69. <el-dialog :visible.sync="close_order_show" width="550px" title="导入信息">
  70. <div style="height:300px;overflow:auto" id="close-order">
  71. <div style="color:#000;font-weight:500">导入信息</div>
  72. <div v-html="close_order_con" style="text-align:center;"></div>
  73. </div>
  74. <span slot="footer" class="dialog-footer">
  75. <el-button @click="close_order_show = false">关闭</el-button>
  76. </span>
  77. </el-dialog>
  78. </div>
  79. </div>
  80. <script>
  81. var app = new Vue({
  82. el:"#app",
  83. delimiters: ['[[', ']]'],
  84. name: 'test',
  85. data() {
  86. return{
  87. form:{},
  88. list:[1,2,3],
  89. close_order_show:false,
  90. close_order_con:'',
  91. }
  92. },
  93. created() {
  94. this.getData()
  95. },
  96. computed: {
  97. // 这里定义上传文件时携带的参数,即表单数据
  98. upData: function() {
  99. return {
  100. body: JSON.stringify(this.form.express)
  101. }
  102. }
  103. },
  104. mounted() {
  105. },
  106. methods: {
  107. getData() {
  108. let loading = this.$loading({target:document.querySelector(".content"),background: 'rgba(0, 0, 0, 0)'});
  109. let url = "{!! yzWebFullUrl('order.batch-send.get-express') !!}";
  110. this.$http.post(url).then(function (response) {
  111. // console.log(response.data.data)
  112. if (response.data.result){
  113. this.list = response.data.data;
  114. loading.close();
  115. } else {
  116. this.$message({message: response.data.msg,type: 'error'});
  117. }
  118. loading.close();
  119. },function (response) {
  120. this.$message({message: response.data.msg,type: 'error'});
  121. loading.close();
  122. }
  123. );
  124. },
  125. getExample(){
  126. let url = "{!! yzWebFullUrl('order.batch-send.get-example') !!}";
  127. this.$http.post(url).then(function (response) {
  128. if (response.status == 200) {
  129. window.location.href = response.url
  130. } else {
  131. console.log(response)
  132. that.$message.error(response.data.msg);
  133. }
  134. });
  135. },
  136. submitUpload(form) {
  137. console.log(form)
  138. this.$refs[form].validate(async valid => {
  139. if (valid) {
  140. // 表单验证通过后使用组件自带的方法触发上传事件
  141. this.$refs.upload.submit()
  142. } else {
  143. return false;
  144. }
  145. });
  146. // this.$refs.upload.submit();
  147. },
  148. handleRemove(file, fileList) {
  149. console.log(file, fileList);
  150. },
  151. handlePreview(file) {
  152. console.log(file,5656566);
  153. },
  154. success(res){
  155. if (res.result) {
  156. this.close_order_show = true;
  157. this.close_order_con = res.data;
  158. console.log(res)
  159. } else {
  160. this.$refs.upload.clearFiles();
  161. this.$message({type: 'error',message: res.msg});
  162. }
  163. }
  164. },
  165. })
  166. </script>
  167. @endsection('content')