edit.vue 14 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  1. <template>
  2. <div class="purchaseOrderEdit-wrap">
  3. <a-page-header :ghost="false" @back="handleBack" >
  4. <!-- 自定义的二级文字标题 -->
  5. <template slot="subTitle">
  6. <a id="purchaseOrderEdit-back-btn" href="javascript:;" @click="handleBack">返回列表</a>
  7. </template>
  8. <!-- 操作区,位于 title 行的行尾 -->
  9. <template slot="extra">
  10. <a-button key="2" id="purchaseOrderEdit-preview-btn">打印预览</a-button>
  11. <a-button key="1" type="primary" id="purchaseOrderEdit-print-btn">快速打印</a-button>
  12. </template>
  13. </a-page-header>
  14. <!-- 内容 -->
  15. <a-page-header title="单号:CG2021010100001" ></a-page-header>
  16. <!-- 基础信息 -->
  17. <a-card :bordered="false" class="purchaseOrderEdit-cont">
  18. <a-collapse :activeKey="['1']">
  19. <a-collapse-panel key="1">
  20. <template slot="header">
  21. 基础信息
  22. <a-button type="primary" shape="circle" size="small" icon="edit" class="edit-circle-btn" id="purchaseOrderEdit-edit-circle-btn" @click.stop="handleEditInfo" />
  23. </template>
  24. <a-descriptions :column="3">
  25. <a-descriptions-item label="供应商">箭冠营销中心</a-descriptions-item>
  26. <a-descriptions-item label="支付方式">箭冠营销中心</a-descriptions-item>
  27. <a-descriptions-item label="收货人">箭冠营销中心</a-descriptions-item>
  28. <a-descriptions-item label="收货地址">箭冠营销中心</a-descriptions-item>
  29. </a-descriptions>
  30. </a-collapse-panel>
  31. </a-collapse>
  32. </a-card>
  33. <!-- 选择产品 -->
  34. <a-card :bordered="false" class="purchaseOrderEdit-cont">
  35. <a-collapse :activeKey="['1']">
  36. <a-collapse-panel key="1">
  37. <template slot="header">
  38. 选择产品<span class="sub-title">①输入查询条件--->②查找到需要采购的产品--->③录入采购数量--->④点击“添加”</span>
  39. <p class="tag-txt">注意:仅限采购【箭冠】产品。自建产品的采购入库请使用“散件入库”功能</p>
  40. </template>
  41. <!-- 选择产品 -->
  42. <div>
  43. <!-- 搜索条件 -->
  44. <div class="table-page-search-wrapper">
  45. <a-form layout="inline" @keyup.enter.native="$refs.table.refresh(true)">
  46. <a-row :gutter="15">
  47. <a-col :md="6" :sm="24">
  48. <a-form-item label="关键词">
  49. <a-input id="purchaseOrderEdit-bundleName" v-model.trim="queryParam.bundleName" allowClear placeholder="产品名称/产品编码/原厂编码/适用车型"/>
  50. </a-form-item>
  51. </a-col>
  52. <a-col :md="6" :sm="24">
  53. <a-form-item label="产品品牌">
  54. <a-select placeholder="请选择" id="purchaseOrderEdit-state" allowClear v-model="queryParam.dataSourceNo" :showSearch="true" option-filter-prop="children" :filter-option="filterOption">
  55. <a-select-option v-for="item in brandData" :key="item.salesChannelNo" :value="item.salesChannelNo">{{ item.salesChannelName }}</a-select-option>
  56. </a-select>
  57. </a-form-item>
  58. </a-col>
  59. <a-col :md="6" :sm="24">
  60. <a-form-item label="产品类别">
  61. <a-cascader :options="typeData" id="purchaseOrderEdit-state" placeholder="请选择产品类别" allowClear v-model="queryParam.brand" />
  62. </a-form-item>
  63. </a-col>
  64. <template v-if="advanced">
  65. <a-col :md="6" :sm="24">
  66. <a-form-item label="适用车型">
  67. <a-cascader :options="typeData" id="purchaseOrderEdit-state" placeholder="请选择适用车型" allowClear v-model="queryParam.brand" />
  68. </a-form-item>
  69. </a-col>
  70. </template>
  71. <a-col :md="6" :sm="24">
  72. <a-button style="margin-bottom: 18px;" type="primary" @click="$refs.table.refresh(true)" :disabled="disabled" id="purchaseOrderEdit-refresh">查询</a-button>
  73. <a-button style="margin: 0 0 18px 8px" @click="resetSearchForm" :disabled="disabled" id="purchaseOrderEdit-reset">重置</a-button>
  74. <a @click="advanced=!advanced" style="margin-left: 8px">
  75. {{ advanced ? '收起' : '展开' }}
  76. <a-icon :type="advanced ? 'up' : 'down'"/>
  77. </a>
  78. </a-col>
  79. </a-row>
  80. </a-form>
  81. </div>
  82. <!-- 列表 -->
  83. <s-table
  84. class="sTable"
  85. ref="table"
  86. size="default"
  87. :rowKey="(record) => record.id"
  88. :columns="columns"
  89. :data="loadData"
  90. bordered>
  91. <!-- 采购数量 -->
  92. <template slot="storageQuantity" slot-scope="text, record">
  93. <a-input-number
  94. id="purchaseOrderEdit-storageQuantity"
  95. :value="record.storageQuantity"
  96. :precision="0"
  97. :min="0"
  98. :max="999999"
  99. placeholder="请输入" />
  100. </template>
  101. <!-- 操作 -->
  102. <template slot="action" slot-scope="text, record">
  103. <a-button size="small" type="primary" @click="handleAdd(record)" id="purchaseOrderEdit-add-btn">添加</a-button>
  104. </template>
  105. </s-table>
  106. </div>
  107. </a-collapse-panel>
  108. </a-collapse>
  109. </a-card>
  110. <!-- 已选产品 -->
  111. <a-card :bordered="false" class="purchaseOrderEdit-cont">
  112. <a-collapse :activeKey="['1']">
  113. <a-collapse-panel key="1">
  114. <template slot="header">
  115. 已选产品
  116. <a-button size="small" class="import-btn" id="purchaseOrderEdit-import-btn" @click.stop="handleImport">导入明细</a-button>
  117. </template>
  118. <!-- 已选产品 -->
  119. <div>
  120. <!-- 总计 -->
  121. <a-alert type="info" showIcon style="margin-bottom:15px">
  122. <div slot="message">产品款数 <strong>6</strong> ,采购数量合计 <strong>6</strong> ,采购金额合计¥<strong>6.33</strong></div>
  123. </a-alert>
  124. <!-- 列表 -->
  125. <s-table
  126. class="sTable"
  127. ref="table"
  128. size="default"
  129. :rowKey="(record) => record.id"
  130. :columns="chooseColumns"
  131. :data="chooseLoadData"
  132. bordered>
  133. <!-- 采购数量 -->
  134. <template slot="storageQuantity" slot-scope="text, record">
  135. <a-input-number
  136. id="purchaseOrderEdit-storageQuantity"
  137. :value="record.storageQuantity"
  138. :precision="0"
  139. :min="0"
  140. :max="999999"
  141. placeholder="请输入" />
  142. </template>
  143. <!-- 操作 -->
  144. <template slot="action" slot-scope="text, record">
  145. <a-button size="small" type="primary" @click="handleDel(record)" id="purchaseOrderEdit-del-btn">删除</a-button>
  146. </template>
  147. </s-table>
  148. </div>
  149. </a-collapse-panel>
  150. </a-collapse>
  151. </a-card>
  152. <a-affix :offset-bottom="0">
  153. <div style="text-align: center;width: 100%;background-color: #fff;padding: 30px 0;box-shadow: 0 0 20px #dcdee2;">
  154. <a-button type="primary" id="purchaseOrderEdit-submit-btn" size="large" @click="handleSubmit" style="padding: 0 60px;">提交</a-button>
  155. </div>
  156. </a-affix>
  157. <!-- 选择基本信息弹框 -->
  158. <basic-info-modal :openModal="openModal" @ok="handleOk" @close="openModal=false" />
  159. </div>
  160. </template>
  161. <script>
  162. import { STable, VSelect } from '@/components'
  163. import basicInfoModal from './basicInfoModal.vue'
  164. export default{
  165. components: { STable, VSelect, basicInfoModal },
  166. data(){
  167. return{
  168. queryParam: {
  169. },
  170. brandData: [], // 产品品牌 下拉数据
  171. typeData: [], // 产品类别 下拉数据
  172. advanced: false, // 高级搜索 展开/关闭
  173. disabled: false, // 查询、重置按钮是否可操作
  174. // 表头
  175. columns: [
  176. { title: '产品编码', dataIndex: 'creatDate', align: 'center', sorter: true },
  177. { title: '产品名称', dataIndex: 'custName', align: 'center', customRender: function (text) { return text || '--' } },
  178. { title: '产品级别', dataIndex: 'custsName', align: 'center', customRender: function (text) { return text || '--' } },
  179. { title: '原厂编码', dataIndex: 'totalP', align: 'center', customRender: function (text) { return text || '--' } },
  180. { title: '终端会员价', dataIndex: 'totalNums', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  181. { title: '车主零售价', scopedSlots: { customRender: 'purchaseNum' }, align: 'center' },
  182. { title: '箱/单位', scopedSlots: { customRender: 'outOfStockNum' }, align: 'center' },
  183. { title: '采购单价', dataIndex: 'mementPay', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  184. { title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, align: 'center' },
  185. { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
  186. ],
  187. // 加载数据方法 必须为 Promise 对象
  188. loadData: parameter => {
  189. this.disabled = true
  190. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  191. // const data = res.data
  192. // const no = (data.pageNo - 1) * data.pageSize
  193. // for (var i = 0; i < data.list.length; i++) {
  194. // data.list[i].no = no + i + 1
  195. // }
  196. // this.disabled = false
  197. // return data
  198. // })
  199. const _this = this
  200. return new Promise(function(resolve, reject){
  201. const data = {
  202. pageNo: 1,
  203. pageSize: 10,
  204. list: [
  205. { id: '1', purchaseNo: 'jgqp11111111111', creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  206. ],
  207. count: 10
  208. }
  209. const no = (data.pageNo - 1) * data.pageSize
  210. for (var i = 0; i < data.list.length; i++) {
  211. data.list[i].no = no + i + 1
  212. }
  213. _this.disabled = false
  214. resolve(data)
  215. })
  216. },
  217. // 表头
  218. chooseColumns: [
  219. { title: '产品编码', dataIndex: 'creatDaite', align: 'center', sorter: true },
  220. { title: '产品名称', dataIndex: 'custNayme', align: 'center', customRender: function (text) { return text || '--' } },
  221. { title: '采购单价', dataIndex: 'mementPay', align: 'center', customRender: function (text) { return ((text || text == 0) ? text : '--') } },
  222. { title: '采购数量', scopedSlots: { customRender: 'storageQuantity' }, align: 'center' },
  223. { title: '单位', dataIndex: 'custsNakme', align: 'center', customRender: function (text) { return text || '--' } },
  224. { title: '采购金额', dataIndex: 'custssNakme', align: 'center', customRender: function (text) { return ((text || text == 0) ? '¥'+text : '--') } },
  225. { title: '操作', scopedSlots: { customRender: 'action' }, width: 150, align: 'center' }
  226. ],
  227. // 加载数据方法 必须为 Promise 对象
  228. chooseLoadData: parameter => {
  229. this.disabled = true
  230. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  231. // const data = res.data
  232. // const no = (data.pageNo - 1) * data.pageSize
  233. // for (var i = 0; i < data.list.length; i++) {
  234. // data.list[i].no = no + i + 1
  235. // }
  236. // this.disabled = false
  237. // return data
  238. // })
  239. const _this = this
  240. return new Promise(function(resolve, reject){
  241. const data = {
  242. pageNo: 1,
  243. pageSize: 10,
  244. list: [
  245. { id: '1', purchaseNo: 'jgqp11111111111', custssName: 0, creatDate: '产品1', custName: 'jgqp111123545', totalP: '箭冠品牌', totalNums: '产品分类1', totalPrice: '5', payType: '122' }
  246. ],
  247. count: 10
  248. }
  249. const no = (data.pageNo - 1) * data.pageSize
  250. for (var i = 0; i < data.list.length; i++) {
  251. data.list[i].no = no + i + 1
  252. }
  253. _this.disabled = false
  254. resolve(data)
  255. })
  256. },
  257. openModal: false, // 选择基本信息弹框是否显示
  258. }
  259. },
  260. methods: {
  261. // 重置
  262. resetSearchForm () {
  263. this.queryParam.orderBundleNo = ''
  264. this.queryParam.orderBundle.custMobile = ''
  265. this.queryParam.bundleName = ''
  266. this.queryParam.itemName = ''
  267. this.oldTime = undefined
  268. this.newTime = undefined
  269. this.$refs.table.refresh(true)
  270. },
  271. // 添加
  272. handleAdd(row){},
  273. // 删除
  274. handleDel(row){},
  275. // 编辑基本信息
  276. handleEditInfo(){
  277. this.openModal = true
  278. },
  279. // 提交
  280. handleSubmit(){
  281. },
  282. // 基本信息 保存
  283. handleOk(){
  284. },
  285. // 返回列表
  286. handleBack(){
  287. this.$router.push({ path: '/purchasingManagement/purchaseOrder/list'})
  288. },
  289. // 导入明细
  290. handleImport(){
  291. console.log(333)
  292. },
  293. filterOption(input, option) {
  294. return (
  295. option.componentOptions.children[0].text.toLowerCase().indexOf(input.toLowerCase()) >= 0
  296. )
  297. },
  298. },
  299. beforeRouteEnter (to, from, next) {
  300. next(vm => {
  301. vm.openModal = false
  302. })
  303. }
  304. }
  305. </script>
  306. <style lang="less">
  307. .purchaseOrderEdit-wrap{
  308. .purchaseOrderEdit-cont{
  309. margin-bottom: 15px;
  310. .sub-title{
  311. font-size: 12px;
  312. color: #808695;
  313. margin-left: 10px;
  314. }
  315. .tag-txt{
  316. font-size: 12px;
  317. color: #ed1c24;
  318. }
  319. .edit-circle-btn{
  320. margin-left: 15px;
  321. i{
  322. vertical-align: text-bottom;
  323. }
  324. }
  325. .import-btn{
  326. margin-left: 15px;
  327. }
  328. }
  329. }
  330. </style>