salesReturnNew.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297
  1. <template>
  2. <div>
  3. <a-affix :target="() => this.$refs.container">
  4. <a-page-header
  5. :ghost="false"
  6. @back="() => $router.go(-1)"
  7. >
  8. <template slot="subTitle">
  9. <a href="javascript:;" @click="() => $router.go(-1)">客户名称:车领主常青二路店</a>
  10. <a-button size="small" @click="handleEditCustom" style="margin-left:50px" key="0">
  11. 编辑
  12. </a-button>
  13. </template>
  14. <template slot="extra">
  15. <a-button key="2">
  16. 打印预览
  17. </a-button>
  18. <a-button key="1" type="primary">
  19. 快速打印
  20. </a-button>
  21. </template>
  22. </a-page-header>
  23. </a-affix>
  24. <a-card :bordered="false" size="small" class="pages-wrap">
  25. <!-- 查询配件列表 -->
  26. <queryPart></queryPart>
  27. </a-card>
  28. <a-card :bordered="false" size="small" class="pages-wrap">
  29. <!-- alert -->
  30. <a-alert style="margin-bottom: 15px;" type="info">
  31. <div slot="message">
  32. <span>退货总金额:15;</span>
  33. <span>总款数:6;</span>
  34. <span>总数量:3;</span>
  35. <span>废品总数量:7;</span>
  36. </div>
  37. </a-alert>
  38. <!-- 查询条件 -->
  39. <a-row :gutter="15">
  40. <a-col :span="18">
  41. <a-form-model layout="inline" :model="productForm" @submit="handleSearch">
  42. <a-form-model-item label="产品编码">
  43. <a-input v-model="productForm.productNo" placeholder="输入产品编码" />
  44. </a-form-model-item>
  45. <a-form-model-item label="产品名称">
  46. <a-input v-model="productForm.productName" placeholder="输入产品名称" />
  47. </a-form-model-item>
  48. <a-form-model-item>
  49. <a-button type="primary">
  50. 查询
  51. </a-button>
  52. <a-button style="margin-left: 10px;">
  53. 重置
  54. </a-button>
  55. </a-form-model-item>
  56. </a-form-model>
  57. </a-col>
  58. <a-col :span="6">
  59. <div style="float:right;overflow: hidden;">
  60. <a-button id="salesNew-dru">导入明细</a-button>
  61. <a-button type="primary" style="margin-left: 15px" id="salesNew-del-all">整单删除</a-button>
  62. </div>
  63. </a-col>
  64. </a-row>
  65. <!-- 已选配件列表 -->
  66. <s-table
  67. class="sTable"
  68. ref="table"
  69. size="default"
  70. :rowKey="(record) => record.id"
  71. :columns="columns"
  72. :data="loadData"
  73. :scroll="{ x: 1500, y: 300 }"
  74. bordered>
  75. <!-- 本次退货数量 -->
  76. <template slot="returnNums" slot-scope="text, record">
  77. <editable-cell :text="text" :step="0.1" @change="onCellChange(record.id, 'returnNums', $event)" />
  78. </template>
  79. <!-- 废品数量 -->
  80. <template slot="fpNums" slot-scope="text, record">
  81. <editable-cell :text="text" :precision="0" @change="onCellChange(record.id, 'fpNums', $event)" />
  82. </template>
  83. <template slot="cangku" slot-scope="text, record">
  84. <a-select :value="text" style="width: 100%">
  85. <a-select-option value="jack">
  86. 默认仓库
  87. </a-select-option>
  88. <a-select-option value="lucy">
  89. Lucy
  90. </a-select-option>
  91. </a-select>
  92. </template>
  93. <template slot="cangwei" slot-scope="text, record">
  94. <a-select :value="text" style="width: 100%">
  95. <a-select-option value="jack">
  96. 默认仓位
  97. </a-select-option>
  98. <a-select-option value="lucy">
  99. Lucy
  100. </a-select-option>
  101. </a-select>
  102. </template>
  103. <!-- 操作 -->
  104. <template slot="action" slot-scope="text, record">
  105. <a-button type="primary" size="small" @click="handleDel(record)">删除</a-button>
  106. </template>
  107. </s-table>
  108. </a-card>
  109. <!-- 选择客户弹框 -->
  110. <chooseCustom :show="openModal" @ok="chooseCustomOk" @cancel="openModal=false"></chooseCustom>
  111. </div>
  112. </template>
  113. <script>
  114. import { STable, VSelect } from '@/components'
  115. import queryPart from './queryPart.vue'
  116. import EditableCell from '@/views/common/editInput.js'
  117. import chooseCustom from './chooseCustom.vue'
  118. export default {
  119. name: 'SalesDetail',
  120. components: {
  121. STable,
  122. VSelect,
  123. queryPart,
  124. EditableCell,
  125. chooseCustom
  126. },
  127. data () {
  128. return {
  129. disabled: false,
  130. openModal: false,
  131. dataSource: [],
  132. productForm: {
  133. productNo: '',
  134. productName: ''
  135. },
  136. // 表头
  137. columns: [
  138. {
  139. title: '序号',
  140. dataIndex: 'no',
  141. align: 'center',
  142. width: 100
  143. },
  144. {
  145. title: '产品编码',
  146. dataIndex: 'productNo',
  147. align: 'center',
  148. },
  149. {
  150. title: '产品名称',
  151. dataIndex: 'productName',
  152. align: 'center'
  153. },
  154. {
  155. title: '原厂编码',
  156. dataIndex: 'ycNo',
  157. align: 'center'
  158. },
  159. {
  160. title: '销售单号',
  161. dataIndex: 'productBrand',
  162. align: 'center',
  163. },
  164. {
  165. title: '售价',
  166. dataIndex: 'price',
  167. align: 'center',
  168. width: 150,
  169. scopedSlots: { customRender: 'price' }
  170. },
  171. {
  172. title: '单位',
  173. dataIndex: 'dw',
  174. align: 'center'
  175. },
  176. {
  177. title: '销售数量',
  178. dataIndex: 'salesNums',
  179. align: 'center'
  180. },
  181. {
  182. title: '本次退货数量',
  183. dataIndex: 'returnNums',
  184. align: 'center',
  185. width: 150,
  186. scopedSlots: { customRender: 'returnNums' }
  187. },
  188. {
  189. title: '废品数量',
  190. dataIndex: 'returnNums',
  191. align: 'center',
  192. width: 150,
  193. scopedSlots: { customRender: 'fpNums' }
  194. },
  195. {
  196. title: '退货存放仓库',
  197. dataIndex: 'cangku',
  198. align: 'center',
  199. scopedSlots: { customRender: 'cangku' },
  200. width: 150
  201. },
  202. {
  203. title: '退货存放仓位',
  204. dataIndex: 'cangwei',
  205. align: 'center',
  206. scopedSlots: { customRender: 'cangwei' },
  207. width: 150
  208. },
  209. {
  210. title: '退货金额小计',
  211. dataIndex: 'xj',
  212. align: 'center'
  213. },
  214. {
  215. title: '折后金额小计',
  216. dataIndex: 'zhxj',
  217. align: 'center'
  218. },
  219. { title: '操作', scopedSlots: { customRender: 'action' }, width: 100, align: 'center' }
  220. ],
  221. // 加载数据方法 必须为 Promise 对象
  222. loadData: parameter => {
  223. this.disabled = true
  224. // return customerBundleDelayList( Object.assign(parameter, this.queryParam) ).then(res => {
  225. // const data = res.data
  226. // const no = (data.pageNo - 1) * data.pageSize
  227. // for (var i = 0; i < data.list.length; i++) {
  228. // data.list[i].no = no + i + 1
  229. // }
  230. // this.disabled = false
  231. // return data
  232. // })
  233. const _this = this
  234. return new Promise(function (resolve, reject) {
  235. const data = {
  236. pageNo: 1,
  237. pageSize: 10,
  238. list: [
  239. {
  240. id: '1',
  241. productNo: 'jgqp11111111111',
  242. productName: '产品1',
  243. ycNo: 'jgqp111123545',
  244. productBrand: '箭冠品牌',
  245. productType: '产品分类1',
  246. price: 5.6,
  247. salesNums: 12
  248. }
  249. ],
  250. count: 10
  251. }
  252. const no = (data.pageNo - 1) * data.pageSize
  253. for (var i = 0; i < data.list.length; i++) {
  254. data.list[i].no = no + i + 1
  255. }
  256. _this.disabled = false
  257. _this.dataSource = data.list
  258. resolve(data)
  259. })
  260. }
  261. }
  262. },
  263. methods: {
  264. onCellChange (key, dataIndex, value) {
  265. console.log(key, dataIndex, value)
  266. console.log(this.dataSource)
  267. const dataSource = [...this.dataSource]
  268. const target = dataSource.find(item => item.id === key)
  269. if (target) {
  270. target[dataIndex] = Number(value)
  271. this.dataSource = dataSource
  272. }
  273. },
  274. handleSearch () {
  275. },
  276. // 选择客户成功
  277. chooseCustomOk (data) {
  278. },
  279. handleEditCustom () {
  280. this.openModal = true
  281. }
  282. }
  283. }
  284. </script>
  285. <style lang="less">
  286. .pages-wrap{
  287. margin-top: 15px;
  288. .sTable{
  289. margin-top: 15px;
  290. }
  291. }
  292. </style>