edit.vue 15 KB

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