importHuoweiModal.vue 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. <template>
  2. <a-modal
  3. centered
  4. class="importHuoweiModal-modal"
  5. :footer="null"
  6. :maskClosable="false"
  7. title="批量导入货位"
  8. v-model="isShow"
  9. @cancle="isShow=false"
  10. :width="750">
  11. <div class="importHuoweiModal-con">
  12. <div class="explain-con">
  13. <div class="explain-item">
  14. <div class="explain-tit">
  15. <span>1</span>下载导入模板
  16. <p>请按照下载的Excel模板填写数据</p>
  17. <a :href="filePath" style="padding: 5px 0 0 23px;display: block;">
  18. <a-icon type="download" style="padding-right: 5px;" />下载导入模板
  19. </a>
  20. </div>
  21. </div>
  22. <div class="explain-item">
  23. <div class="explain-tit">
  24. <span>2</span>准备导入数据
  25. </div>
  26. <ul>
  27. <li>1) 导入的Excel文件中必须包含名为“货位号”、“产品编码”、“销售价”、“结算价”、“最大库容”的列,且名称必须相同,其他列可自定义,不影响数据导入。</li>
  28. <li>2) 如果“产品编码”列为空,则表示此货位暂时不绑定产品,也可以正常导入货位。</li>
  29. <li>3) 当“销售价”和“结算价”都为空,系统会自动取该产品的车主价和终端会员价,作为销售价和结算价。</li>
  30. <li>4) 如果货位已经绑定产品,则不会导入该行。</li>
  31. </ul>
  32. </div>
  33. <div class="explain-item">
  34. <div class="explain-tit">
  35. <span>3</span>上传数据文件
  36. </div>
  37. <p>目前支持的文件类型*.xls,*.xlsx.</p>
  38. <div style="overflow: hidden;padding-left: 23px;">
  39. <Upload
  40. id="importHuoweiModal-attachList"
  41. ref="importUpload"
  42. :maxNums="1"
  43. fileType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet,application/vnd.ms-excel"
  44. uploadType="import"
  45. :action="attachAction"
  46. :uploadParams="uploadParams"
  47. upText="添加文件"
  48. @change="changeImport"></Upload>
  49. </div>
  50. </div>
  51. </div>
  52. <!-- 按钮 -->
  53. <div class="btn-con">
  54. <a-button
  55. type="primary"
  56. id="importHuoweiModal-nextStep"
  57. size="large"
  58. class="button-primary"
  59. @click="handlerNextStep"
  60. style="padding: 0 60px;">下一步</a-button>
  61. <a-button
  62. id="importHuoweiModal-cancel"
  63. size="large"
  64. class="button-cancel"
  65. @click="isShow=false"
  66. style="padding: 0 60px;margin-left: 15px;">取消</a-button>
  67. </div>
  68. </div>
  69. <!-- 导入 -->
  70. <chooseImportModal :openModal="openImportModal" :paramsData="paramsData" @close="handleClose" @ok="hanldeOk" />
  71. </a-modal>
  72. </template>
  73. <script>
  74. import ChooseImportModal from './chooseShelfImportModal.vue'
  75. import { Upload } from '@/components'
  76. export default {
  77. name: 'ImportHuoweiModalModal',
  78. components: { ChooseImportModal, Upload },
  79. props: {
  80. openModal: { // 弹框显示状态
  81. type: Boolean,
  82. default: false
  83. },
  84. shelfSn: {
  85. type: [String, Number],
  86. default: ''
  87. }
  88. },
  89. data () {
  90. return {
  91. isShow: this.openModal, // 是否打开弹框
  92. openImportModal: false, // 导入
  93. filePath: 'https://jianguan-images.oss-cn-beijing.aliyuncs.com/template/importProductToShelfTpl.xlsx', // 文件地址
  94. attachAction: process.env.VUE_APP_API_BASE_URL + '/upload',
  95. paramsData: null,
  96. uploadParams: {
  97. savePathType: 'local'
  98. }
  99. }
  100. },
  101. methods: {
  102. // 下一步
  103. handlerNextStep () {
  104. if (this.paramsData) {
  105. this.openImportModal = true
  106. } else {
  107. this.$message.warning('添加文件后再进行下一步操作!')
  108. }
  109. },
  110. // 上传文件 change
  111. changeImport (file) {
  112. if (file) {
  113. this.paramsData = {
  114. shelfSn: this.shelfSn || '',
  115. path: file
  116. }
  117. console.log(this.paramsData, 'this.paramsData')
  118. }
  119. },
  120. // 导入
  121. hanldeOk (obj) {
  122. if (obj && obj.length > 0) {
  123. this.$emit('ok', obj)
  124. this.isShow = false
  125. }
  126. },
  127. // 关闭
  128. handleClose () {
  129. this.openImportModal = false
  130. this.isShow = false
  131. }
  132. },
  133. watch: {
  134. // 父页面传过来的弹框状态
  135. openModal (newValue, oldValue) {
  136. this.isShow = newValue
  137. },
  138. // 重定义的弹框状态
  139. isShow (newValue, oldValue) {
  140. if (!newValue) {
  141. this.$emit('close')
  142. this.paramsData = null
  143. this.$refs.importUpload.setFileList('')
  144. }
  145. }
  146. }
  147. }
  148. </script>
  149. <style lang="less" scoped>
  150. .importHuoweiModal-modal{
  151. .importHuoweiModal-con{
  152. .explain-con{
  153. .explain-item{
  154. margin-bottom: 10px;
  155. .explain-tit{
  156. font-weight: bold;
  157. span{
  158. display: inline-block;
  159. width: 18px;
  160. height: 18px;
  161. line-height: 16px;
  162. text-align: center;
  163. margin-right: 5px;
  164. border-radius: 50%;
  165. border: 1px solid rgba(0, 0, 0, 0.3);
  166. }
  167. }
  168. p{
  169. margin: 8px 0;
  170. padding-left: 23px;
  171. }
  172. ul{
  173. list-style: none;
  174. padding: 0;
  175. padding-left: 23px;
  176. margin: 0;
  177. li{
  178. line-height: 26px;
  179. }
  180. }
  181. }
  182. #importHuoweiModal-attachList{
  183. width: 100%;
  184. }
  185. }
  186. .btn-con{
  187. margin: 10px 0 20px;
  188. text-align: center;
  189. .button-cancel{
  190. font-size: 12px;
  191. }
  192. }
  193. }
  194. }
  195. </style>