customer_sales_details.vue 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <div>
  3. <el-page-header content="详情" style=" padding: 20px 20px 0 20px;" @back="handleBack" />
  4. <sales-header ref="header" />
  5. <sales-table :data-list="dataList" :column="column" @handleSelection="handleSelection">
  6. <template #events>
  7. <el-button
  8. v-if="details.status == 1 && isFront !== false"
  9. type="primary"
  10. size="mini"
  11. @click="handleInform(2)"
  12. >通知发货</el-button>
  13. <el-button v-if="details.status == 2 && isFront !== false" size="mini" @click="handleSendRevoke(1)">撤销发货</el-button>
  14. <el-button v-if="isFront === false && details.status == 1" type="primary" size="mini" @click="handleSignIn(4)">
  15. 签收
  16. </el-button>
  17. </template>
  18. </sales-table>
  19. <LogisticsTabs v-if="details.status == 2 " style="margin:20px;" />
  20. <sales-dialog
  21. :dialog-visible="dialogVisible"
  22. :customer-number="customerNumber"
  23. :func="getDialogList"
  24. @confirm="confirm"
  25. />
  26. </div>
  27. </template>
  28. <script>
  29. import SalesDialog from '@/components/SalesDialog/SalesDialog'
  30. import SalesHeader from '@/components/SalesHeader/SalesHeader'
  31. import SalesTable from '@/components/SalesTable/SalesTable'
  32. import { addFrontOrder, getFrontOrderDetail, sbumitFrontOrder, signIn, setSendRevoke } from '@/api/sales'
  33. import { getcustomerFrontList } from '@/api/stock'
  34. import LogisticsTabs from '@/components/LogisticsTabs'
  35. export default {
  36. name: 'WarehouseForm',
  37. components: {
  38. SalesHeader,
  39. SalesTable,
  40. SalesDialog,
  41. LogisticsTabs
  42. },
  43. props: ['detailsId', 'pageType'],
  44. data() {
  45. return {
  46. dialogVisible: false,
  47. customerNumber: '',
  48. dataList: [],
  49. details: {},
  50. selection: [],
  51. flag: 1,
  52. column: [
  53. {
  54. prop: 'materialName',
  55. label: '产品名称',
  56. width: '180'
  57. },
  58. {
  59. prop: 'materialCode',
  60. label: '物料编码',
  61. width: '180'
  62. },
  63. {
  64. prop: 'specification',
  65. label: '规格型号',
  66. width: '300'
  67. },
  68. // {
  69. // prop: 'stockQty',
  70. // label: '库存数量',
  71. // width: '180'
  72. // },
  73. {
  74. prop: 'qty',
  75. label: '数量',
  76. width: '180'
  77. },
  78. // {
  79. // prop: 'volume',
  80. // label: '体积',
  81. // width: '180'
  82. // },
  83. // {
  84. // prop: 'totalVolume',
  85. // label: '总体积',
  86. // width: '180'
  87. // },
  88. {
  89. prop: 'notes',
  90. label: '备注'
  91. }
  92. ],
  93. activities: [
  94. {
  95. content: '活动按期开始',
  96. color: '#0bbd87',
  97. timestamp: '2018-04-15'
  98. },
  99. {
  100. content: '通过审核',
  101. timestamp: '2018-04-13'
  102. },
  103. {
  104. content: '创建成功',
  105. timestamp: '2018-04-11'
  106. }
  107. ],
  108. isFront: null
  109. }
  110. },
  111. created() {
  112. this.isFront = JSON.parse(localStorage.getItem('supply_user')).isFront
  113. console.log(this.isFront)
  114. if (this.detailsId) {
  115. getFrontOrderDetail({ id: this.detailsId }).then(res => {
  116. this.dataList = res.data.orders
  117. this.details = res.data
  118. this.$refs.header.screenForm = res.data
  119. this.$refs.header.screenForm.disabled = true
  120. this.$refs.header.screenForm.provinceId = res.data.province
  121. this.$refs.header.screenForm.cityId = res.data.city
  122. this.$refs.header.screenForm.areaId = res.data.area
  123. this.$refs.header.screenForm.streetId = res.data.street
  124. this.$refs.header.screenForm.stockType = res.data.stockType == 1 ? '前置仓' : '商家仓'
  125. })
  126. }
  127. },
  128. methods: {
  129. getDialogList(p) {
  130. return getcustomerFrontList(...p)
  131. },
  132. confirm(selected) {
  133. // console.log(selected)
  134. this.dataList = selected
  135. this.$refs.header.screenForm.customerName = this.dataList[0].customerName
  136. this.$refs.header.screenForm.customerNumber = this.dataList[0].customerNumber
  137. this.customerNumber = this.dataList[0].customerNumber
  138. this.dialogVisible = false
  139. },
  140. handleDel(item, index) {
  141. this.dataList.splice(index, 1)
  142. },
  143. delChange() {
  144. this.dataList.forEach((k, i) => {
  145. this.selection.forEach((l, e) => {
  146. if (k.id === l.id) {
  147. this.dataList.splice(i, 1)
  148. this.selection.splice(e, 1)
  149. }
  150. })
  151. })
  152. },
  153. handleSelection(data) {
  154. this.selection = data
  155. },
  156. handelSubmit() {
  157. this.dataList.forEach(k => {
  158. k.id = ''
  159. k.directFlag = k.flag
  160. })
  161. const params = {
  162. ...this.$refs.header.screenForm,
  163. orders: this.dataList
  164. }
  165. addFrontOrder(params).then(res => {
  166. this.$successMsg('新增成功')
  167. this.handleBack()
  168. this.$forceUpdate()
  169. })
  170. },
  171. handelSigning() {},
  172. handleInform(status = 2) {
  173. sbumitFrontOrder({ id: this.$refs.header.screenForm.id, status }).then(res => {
  174. this.$successMsg('发货通知')
  175. this.handleBack()
  176. })
  177. },
  178. handleSignIn(status) {
  179. this.$confirm('请确定,订单产品客户已完成签收,一旦签收则不能撤销', '提示', {
  180. confirmButtonText: '确定',
  181. cancelButtonText: '取消',
  182. type: 'warning'
  183. }).then(res => {
  184. signIn({ id: this.$refs.header.screenForm.id, status }).then(res => {
  185. this.$successMsg('签收')
  186. this.handleBack()
  187. })
  188. }).catch(() => {
  189. })
  190. },
  191. handleSendRevoke(status) {
  192. setSendRevoke({ id: this.$refs.header.screenForm.id, status }).then(res => {
  193. this.$successMsg('撤销发货')
  194. this.handleBack()
  195. })
  196. },
  197. handleBack() {
  198. this.$emit('close')
  199. }
  200. }
  201. }
  202. </script>
  203. <style scoped></style>