detail.vue 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263
  1. <template>
  2. <div class="BidSystemProductDeOrderEdit">
  3. <Toptitle title="拆单页">
  4. <slot name="titleButton">
  5. <Button @click="goback()"
  6. type="primary"
  7. ghost
  8. style="margin-right:10px;">取消</Button>
  9. <Button @click="postData()"
  10. type="primary"
  11. ghost
  12. style="margin-right:10px;">保存</Button>
  13. </slot>
  14. </Toptitle>
  15. <div class="top_search">
  16. <div><span>订单号:</span>{{formData.order_no}}</div>
  17. <div><span>小区名称:</span>{{formData.residential_name}}</div>
  18. <div><span>客户姓名:</span>{{formData.client_name}}</div>
  19. <div><span>紧急程度:</span><span v-for="_item in warningList"
  20. :key="_item.id"
  21. v-show="_item.id==formData.warning_state">{{_item.title}}</span></div>
  22. <div><span>收款:</span>{{formData.pay_state==1?'已收款':'未收款'}}</div>
  23. <div><span>详细地址:</span>{{formData.address}}</div>
  24. <div><span>手机号:</span>{{formData.mobile}}</div>
  25. <div><span>开始日期:</span>{{func.replaceDate(formData.start_time)}}</div>
  26. <div><span>交付日期:</span>{{func.replaceDate(formData.end_time)}}</div>
  27. <div><span>业务员:</span> <span v-for="item in salesmanList"
  28. :key="item.id"
  29. v-show="formData.salesman==item.id">{{formData.salesman}}</span>
  30. </div>
  31. <!-- <div><span>订单类型:</span>{{formData.renovation_type==1?"工装":"家装"}}</div> -->
  32. <div><span>备注:</span>{{formData.remark}}</div>
  33. </div>
  34. <div class="addArea">
  35. <div class="addAreaTable">
  36. <Table :columns="tableColumns"
  37. :data="formData.detail"
  38. border>
  39. <template slot="set"
  40. slot-scope="{row,index}">
  41. <a style="margin:0 5px"
  42. @click="handleSet(row,index,1)">拆单</a>
  43. <a style="margin:0 5px"
  44. @click="handleSet(row,index,2)">详情</a>
  45. </template>
  46. </Table>
  47. </div>
  48. </div>
  49. </div>
  50. </template>
  51. <script>
  52. // 这里可以导入其他文件(比如:组件,工具js,第三方插件js,json文件,图片文件等等)
  53. // 例如:import 《组件名称》 from '《组件路径》';
  54. export default {
  55. name: 'BidSystemProductDeOrderEdit',
  56. components: {
  57. },
  58. props: {},
  59. // import引入的组件需要注入到对象中才能使用
  60. data () {
  61. // 这里存放数据
  62. return {
  63. showSupModal: false,
  64. showPDTModal: false,
  65. formData: {
  66. order_no: '',
  67. orders_area_product_detail_id: '',
  68. residential_name: '',
  69. client_name: '',
  70. address: '',
  71. mobile: '',
  72. pay_state: '',
  73. warning_state: '',
  74. salesman: '',
  75. remark: '',
  76. //区域列表
  77. area: [
  78. {
  79. num: '',
  80. title: '',
  81. unit: '',
  82. quantity: '',
  83. house_type: '',
  84. remark: '',
  85. order_no: '',
  86. product: [
  87. // {
  88. // title:'',
  89. // num:'',
  90. // measure:'',
  91. // process_property:'',
  92. // url:'',
  93. // url_number:'',
  94. // remark:''
  95. // }
  96. ]
  97. }
  98. ],
  99. },
  100. product: [{}],
  101. tableColumns: [
  102. { title: '序号', key: 'id', align: 'center', minWidth: 80 },
  103. { title: '产品名称', key: 'title', align: 'center', minWidth: 120 },
  104. { title: '计量单位', key: 'unit', align: 'center', minWidth: 100 },
  105. { title: '图号', key: 'url_number', align: 'center', minWidth: 80 },
  106. { title: '数量', key: 'num', align: 'center', minWidth: 80 },
  107. { title: '价格', key: 'price', align: 'center', minWidth: 80 },
  108. { title: '规格', key: 'measure', align: 'center', minWidth: 140 },
  109. { title: '工艺属性', key: 'process_property', align: 'center', minWidth: 140, tooltip: true },
  110. {
  111. title: '图纸', key: 'url', align: 'center', minWidth: 80,
  112. render: (h, params) => {
  113. const { row } = params
  114. return h('div', row.url.map((item, index) => {
  115. return h('img', {
  116. attrs: {
  117. src: this.$store.state.ip + item,
  118. style: 'max-width:50px;max-height:50px;position:relative;top:3px;'
  119. },
  120. on: {
  121. click: (e) => {
  122. // this.axios('/api/orders_img', { params: { id: row.id, type: 1 } }).then(res => {
  123. // if (res.code == 200) {
  124. // row.imgs = res.data
  125. let list = []
  126. row.url.forEach(el => {
  127. list.push({ 'img_url': el })
  128. });
  129. this.$previewImg({
  130. list,
  131. baseUrl: this.$store.state.ip,
  132. baseImgField: 'img_url',
  133. baseTitleField: ''
  134. })
  135. // }
  136. // })
  137. }
  138. }
  139. })
  140. }))
  141. }
  142. },
  143. { title: '备注', key: 'remark', align: 'center', minWidth: 80 },
  144. { title: '操作', key: 'name', align: 'center', width: '120', slot: 'set', minWidth: 80, fixed: 'right' },
  145. ],
  146. //产品分类列表
  147. PDTTypeList: [],
  148. //业务员列表
  149. salesmanList: [],
  150. warningList: [],
  151. }
  152. },
  153. // 生命周期 - 创建完成(可以访问当前this实例)
  154. created () {
  155. // 2编辑 3详情 4变更 5变更记录
  156. this.$route.query.type == 3 ? this.isChecked = true : ''
  157. this.$route.query.order_no ? this.formData.order_no = this.$route.query.order_no : ''
  158. this.$route.query.orders_area_product_detail_id ? this.formData.orders_area_product_detail_id = this.$route.query.orders_area_product_detail_id : ''
  159. // 获取紧急程度
  160. this.axios.get('/api/warning_list').then(res => { this.warningList = res.data.data })
  161. },
  162. // 生命周期 - 挂载完成(可以访问DOM元素)
  163. mounted () {
  164. this.axios('/api/user').then(res => this.salesmanList = res.data.data)
  165. this.axios('/api/parts_product_list').then(res => { this.PDTTypeList = res.data })
  166. this.initData(this.formData.order_no, this.formData.orders_area_product_detail_id)
  167. },
  168. methods: {
  169. initData (order_no, orders_area_product_detail_id) {
  170. this.axios({
  171. method: 'get',
  172. url: '/api/order_area_explode',
  173. params: {
  174. order_no,
  175. }
  176. }).then((res) => {
  177. this.formData = res.data
  178. this.formData.list.forEach(element => {
  179. element.product.forEach((el, index) => {
  180. el.index = index + 1
  181. });
  182. });
  183. }).catch((err) => { });
  184. },
  185. // 1拆单 2详情
  186. handleSet (row, index, type) {
  187. this.$router.push({
  188. path: '/cms/BidSystem/ProductDeOrder/deorderdetail',
  189. query: {
  190. type,
  191. order_no: this.$route.query.order_no,
  192. orders_area_product_detail_id: row.id
  193. }
  194. })
  195. },
  196. postData () {
  197. this.axios({
  198. method: 'post',
  199. url: '/api/order_area_add',
  200. data: {
  201. ...this.formData
  202. }
  203. }).then((res) => {
  204. this.$Message.success(res.msg)
  205. }).catch((err) => { });
  206. },
  207. goback () { this.$router.go(-1) }
  208. },
  209. // 监听属性 类似于data概念
  210. computed: {},
  211. // 监控data中的数据变化
  212. watch: {},
  213. beforeCreate () { }, // 生命周期 - 创建之前
  214. beforeMount () { }, // 生命周期 - 挂载之前
  215. beforeUpdate () { }, // 生命周期 - 更新之前
  216. updated () { }, // 生命周期 - 更新之后
  217. beforeDestroy () { }, // 生命周期 - 销毁之前
  218. destroyed () { }, // 生命周期 - 销毁完成
  219. activated () { }, // 如果页面有keep-alive缓存功能,这个函数会触发
  220. }
  221. </script>
  222. <style lang='scss' scoped>
  223. .BidSystemProductDeOrderEdit {
  224. overflow: hidden;
  225. overflow-y: auto;
  226. .top_search {
  227. display: flex;
  228. justify-content: space-around;
  229. align-items: center;
  230. flex-wrap: wrap;
  231. width: 100%;
  232. padding: 10px 0;
  233. font-size: 14px;
  234. div {
  235. width: 200px;
  236. padding: 5px;
  237. }
  238. }
  239. .addArea {
  240. .addAreaTable {
  241. padding: 20px 0;
  242. }
  243. position: relative;
  244. padding: 15px;
  245. margin-bottom: 30px;
  246. border-radius: 5px;
  247. box-shadow: 1px 1px 5px 1px #999;
  248. .addAreaBtn {
  249. position: absolute;
  250. right: 20px;
  251. top: 20px;
  252. }
  253. /deep/ .ivu-form-item {
  254. display: inline-block;
  255. width: 220px;
  256. }
  257. }
  258. }
  259. </style>