edit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  1. <template>
  2. <div>
  3. <el-button :disabled="data.status !=='新建'" type="primary" size="mini" @click="onShow(drawer = true)">编辑</el-button>
  4. <el-drawer
  5. :visible.sync="drawer"
  6. direction="rtl"
  7. append-to-body
  8. size="80%">
  9. <div slot="title">
  10. <div class="flex-align-center">
  11. <p><span style="font-size:14px">订单合计:</span><span style="color:red;font-size:16px;"><b>¥&nbsp;{{tool.formatAmount(data.amount,2)}}</b></span></p>
  12. <label style="font-size:14px;margin-left:10px" for="">备注:</label>
  13. <input class="order__note__input" v-model="defaultData.remarks" type="text" placeholder="请输入订单备注">
  14. </div>
  15. </div>
  16. <div class="drawer__panel">
  17. <div class="flex-align-center normal-margin">
  18. <div style="flex:1;margin-right:10px">
  19. <div class="mt-10">
  20. <p class="normal-title inline-16">收货信息</p>
  21. <el-popover
  22. placement="bottom"
  23. title="选择地址"
  24. trigger="click"
  25. v-model="visible">
  26. <el-table
  27. :data="receiveAddresslist"
  28. style="width: 100%"
  29. size="mini">
  30. <el-table-column
  31. prop="name"
  32. label="联系人"
  33. width="90">
  34. </el-table-column>
  35. <el-table-column
  36. prop="phonenumber"
  37. label="电话"
  38. width="120">
  39. </el-table-column>
  40. <el-table-column
  41. label="地址"
  42. width="360">
  43. <template slot-scope="scope">
  44. {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
  45. </template>
  46. </el-table-column>
  47. <el-table-column
  48. label="操作"
  49. width="90">
  50. <template slot-scope="scope">
  51. <el-button type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">选 择</el-button>
  52. </template>
  53. </el-table-column>
  54. </el-table>
  55. <el-button slot="reference" type="text" size="mini">选择其他地址</el-button>
  56. </el-popover>
  57. </div>
  58. <div class="reveive__panel normal-margin">
  59. <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
  60. <small>{{defaultData.re_info.province}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:'--'}}</small>
  61. </div>
  62. </div>
  63. <div style="flex:1">
  64. <div class="mt-10">
  65. <p class="normal-title inline-16">物流公司</p>
  66. <el-popover
  67. placement="bottom"
  68. title="选择公司"
  69. trigger="click"
  70. v-model="visible1">
  71. <el-table
  72. :data="logisticcomlist"
  73. style="width: 100%"
  74. size="mini">
  75. <el-table-column
  76. prop="abbreviation"
  77. label="公司简称"
  78. width="120">
  79. </el-table-column>
  80. <el-table-column
  81. prop="kd100id"
  82. label="快递100ID"
  83. width="120">
  84. </el-table-column>
  85. <el-table-column
  86. label="操作"
  87. width="90">
  88. <template slot-scope="scope">
  89. <el-button type="text" @click="(defaultData.logist_info = scope.row,visible1 = false)" size="mini">选 择</el-button>
  90. </template>
  91. </el-table-column>
  92. </el-table>
  93. <el-button slot="reference" type="text" size="mini">选择其他公司</el-button>
  94. </el-popover>
  95. </div>
  96. <div class="reveive__panel normal-margin">
  97. <p><span class="inline-16"><b>{{defaultData.logist_info.abbreviation}}</b></span></p>
  98. <small>快递100ID: {{defaultData.logist_info.kd100id}}</small>
  99. </div>
  100. </div>
  101. </div>
  102. <div class="mt-10">
  103. <p class="normal-title inline-16">选择账户</p>
  104. </div>
  105. <div class="flex-align-center-wrap flex-between normal-margin">
  106. <div class="account__panel" :class="defaultData.accountclass.sa_accountclassid === item.sa_accountclassid?'act':''" v-for="(item) in accountlist" :key="item.index" @click="defaultData.accountclass = item">
  107. <p><b>¥{{tool.formatAmount(item.balance,2)}}</b></p>
  108. <small>{{item.accountname}}</small>
  109. </div>
  110. </div>
  111. <div class="mt-10">
  112. <p class="normal-title inline-16">选择财务信息</p>
  113. <el-popover
  114. placement="bottom"
  115. title="选择公司"
  116. trigger="click"
  117. v-model="visible2">
  118. <el-table
  119. :data="financiallist"
  120. style="width: 100%"
  121. size="mini">
  122. <el-table-column
  123. prop="enterprisename"
  124. label="公司抬头"
  125. width="120">
  126. </el-table-column>
  127. <el-table-column
  128. prop="address"
  129. label="开票地址"
  130. width="120">
  131. </el-table-column>
  132. <el-table-column
  133. prop="bank"
  134. label="开户行"
  135. width="120">
  136. </el-table-column>
  137. <el-table-column
  138. prop="bankcardno"
  139. label="开户账号"
  140. width="120">
  141. </el-table-column>
  142. <el-table-column
  143. label="操作"
  144. width="90">
  145. <template slot-scope="scope">
  146. <el-button type="text" @click="(defaultData.fin_info = scope.row,visible2 = false)" size="mini">选 择</el-button>
  147. </template>
  148. </el-table-column>
  149. </el-table>
  150. <el-button slot="reference" type="text" size="mini">选择其他</el-button>
  151. </el-popover>
  152. </div>
  153. <div class="reveive__panel normal-margin">
  154. <p><small>抬头:&nbsp;</small><span class="inline-16"><b>{{defaultData.fin_info.enterprisename}}</b></span></p>
  155. <p><small>开票地址:&nbsp;</small>{{defaultData.fin_info.address}}</p>
  156. <p><small>开户行:&nbsp;</small> {{defaultData.fin_info.bank}} &emsp;<small>开户账号:&nbsp;</small> {{defaultData.fin_info.bankcardno}}</p>
  157. </div>
  158. <div class="mt-10">
  159. <div>
  160. <p class="normal-title inline-16">订单产品</p>
  161. <el-button type="text" size="mini" @click="addMoreProduct">添加更多产品</el-button>
  162. </div>
  163. <el-row :gutter="10">
  164. <el-col :span="setcol">
  165. <product-list ref="prolist" :type="'edit'" @onSuccess="onDelSuccess"></product-list>
  166. </el-col>
  167. <el-col :span="24 - setcol">
  168. <add-product ref="addpro" @onConfirm="onConfirm"></add-product>
  169. </el-col>
  170. </el-row>
  171. </div>
  172. </div>
  173. <div class="fixed__btn__panel">
  174. <el-button size="small" @click="drawer = false" class="normal-btn-width">取 消</el-button>
  175. <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">保存修改</el-button>
  176. </div>
  177. </el-drawer>
  178. </div>
  179. </template>
  180. <script>
  181. import previewImage from '@/components/previewImage/index.vue'
  182. import productList from './productlist.vue'
  183. import addProduct from '@/template/orderCanUseProduct/index.vue'
  184. export default {
  185. props:['data'],
  186. components:{
  187. previewImage,
  188. productList,
  189. addProduct
  190. },
  191. data () {
  192. return {
  193. visible:false,
  194. visible1:false,
  195. visible2:false,
  196. visible3:false,
  197. drawer:false,
  198. receiveAddresslist:[],
  199. accountlist:[],
  200. logisticcomlist:[],
  201. financiallist:[],
  202. defaultData:{
  203. re_info:{},
  204. logist_info:{},
  205. fin_info:{},
  206. accountclass:{},
  207. account_index:0
  208. },
  209. agnetInfo:{},
  210. total:0,
  211. setcol:24
  212. }
  213. },
  214. methods:{
  215. onShow () {
  216. this.queryAgentiInfo()
  217. },
  218. async queryAgentiInfo () {
  219. const res = await this.$api.requested({
  220. "id": "20221022165203",
  221. "content": {}
  222. })
  223. this.agnetInfo = res.data
  224. this.receiveAddress()
  225. this.queryAccount()
  226. this.queryLogisticcom()
  227. this.queryFinancial()
  228. },
  229. // 收货信息:合作企业联系人
  230. async receiveAddress () {
  231. const res = await this.$api.requested({
  232. "id": "20221009155803",
  233. "content": {
  234. "sys_enterpriseid":this.agnetInfo.sys_enterpriseid,
  235. "where":{
  236. "condition":"",
  237. "workaddress":0
  238. }
  239. }
  240. })
  241. this.receiveAddresslist = res.data
  242. this.defaultData.re_info = res.data[0]
  243. },
  244. // 账号信息
  245. async queryAccount () {
  246. const res = await this.$api.requested({
  247. "id": "20221008134803",
  248. "content": {
  249. "pageNumber": 1,
  250. "pageSize": 100
  251. }
  252. })
  253. this.accountlist = res.data
  254. this.defaultData.accountclass = this.data.accountclass
  255. },
  256. // 物流企业
  257. async queryLogisticcom () {
  258. const res = await this.$api.requested({
  259. "id": "20221121135804",
  260. "content": {
  261. "pageNumber": 1,
  262. "pageSize": 100
  263. }
  264. })
  265. this.logisticcomlist = res.data
  266. this.defaultData.logist_info = this.data.logiscomp
  267. },
  268. // 财务信息
  269. async queryFinancial () {
  270. const res = await this.$api.requested({
  271. "id": "20221013160602",
  272. "content": {
  273. "sys_enterpriseid":this.agnetInfo.sys_enterpriseid,
  274. "pageNumber": 1,
  275. "pageSize": 100
  276. }
  277. })
  278. this.financiallist = res.data
  279. this.defaultData.fin_info = this.data.finance
  280. },
  281. async onSubmit() {
  282. console.log(this.data)
  283. const res = await this.$api.requested({
  284. "id": 20221108111402,
  285. "content": {
  286. "sa_orderid": this.$route.query.id,
  287. "sys_enterpriseid": 1, //订货企业id
  288. "sa_accountclassid": this.defaultData.accountclass.sa_accountclassid, //营销账户类型ID
  289. "sa_brandid": this.data.sa_brandid, //品牌ID
  290. // "sa_contractid":this.data.sa_contractid, //合同ID,标准订单不传
  291. // "sa_projectid": this.data.sa_projectid, //工程项目表ID,标准订单不传
  292. "sys_enterprise_financeid": this.defaultData.fin_info.sys_enterprise_financeid, //合作企业财务信息ID(开票信息)
  293. "sa_logiscompid": this.defaultData.logist_info.sa_logiscompid, //物流公司档案ID
  294. "rec_contactsid": this.defaultData.re_info.contactsid, //合作企业联系人表ID(收货信息)
  295. "type": this.data.type, //订单类型
  296. "typemx":this.data.typemx, //明细分类,可选
  297. "remarks": this.data.remarks, //可选
  298. // "saler_hrid":this.data.saler_hrid//销售人员hrid,业务员hrid
  299. },
  300. })
  301. this.tool.showMessage(res,()=>{
  302. this.$emit('onSuccess')
  303. this.drawer = false
  304. })
  305. },
  306. onDelSuccess () {
  307. this.$refs.addpro.listData()
  308. },
  309. addMoreProduct () {
  310. this.setcol = 12
  311. },
  312. // 订单添加商品
  313. async onConfirm (data) {
  314. const res = await this.$api.requested({
  315. "id": 20221109093602,
  316. "content": {
  317. "sa_orderid": this.$route.query.id, //订单ID
  318. "sys_enterpriseid": this.data.sys_enterpriseid, //企业ID
  319. "type": "标准订单", //订单类型
  320. "items": data.map(e=>{
  321. return {
  322. sa_orderitemsid:0,
  323. itemid:e.itemid,
  324. qty:e.orderminqty
  325. }
  326. })
  327. },
  328. })
  329. this.tool.showMessage(res,()=>{
  330. this.setcol = 24
  331. this.$refs['prolist'].listData()
  332. })
  333. }
  334. },
  335. mounted () {
  336. }
  337. }
  338. </script>
  339. <style>
  340. </style>
  341. <style scoped>
  342. .reveive__panel{
  343. font-size: 14px;
  344. line-height: 30px;
  345. padding: 10px;
  346. background: #d9ecff;
  347. border: 1px dashed #0676e7;
  348. }
  349. .account__panel small,.reveive__panel small{
  350. color:#666
  351. }
  352. .account__panel{
  353. width: calc(33% - 26px);
  354. padding: 10px;
  355. margin-bottom:10px;
  356. border: 1px dashed #666;
  357. }
  358. .act{
  359. background: #d9ecff;
  360. border: 1px dashed #0676e7;
  361. }
  362. .image {
  363. width:40px;height:40px;margin:0px auto;
  364. }
  365. .order__note__input{
  366. border: none;
  367. outline: none;
  368. /* margin-left: 10px; */
  369. /* border-bottom: 1px solid #f1f2f3; */
  370. flex:1
  371. }
  372. </style>