edit.vue 14 KB

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