edit.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328
  1. <template>
  2. <div>
  3. <el-button :disabled="data.status !=='新建'" type="primary" size="mini" @click="onShow(drawer = true)">{{$t('编辑')}}</el-button>
  4. <el-drawer
  5. :visible.sync="drawer"
  6. :wrapperClosable="false"
  7. direction="rtl"
  8. append-to-body
  9. size="80%">
  10. <div slot="title">
  11. <div class="flex-align-center">
  12. <p>{{$t(`编辑发货单`)}}</p>
  13. </div>
  14. </div>
  15. <div class="drawer__panel">
  16. <div class="normal-margin">{{$t(`发货数量`)}}:{{data.qty}}</div>
  17. <div class="normal-margin">{{$t(`发货金额`)}}:{{data.sumamount ? tool.formatAmount(data.sumamount,2) : '--'}}</div>
  18. <div class="mt-10">
  19. <p class="normal-title inline-16"><span v-if="siteid == 'YOSTEST1' || siteid == 'HY'" style="color: red">*</span><span>{{$t(`发货时间`)}}</span></p>
  20. <!-- billdate -->
  21. <el-date-picker
  22. v-model="defaultData.billdate"
  23. type="date"
  24. value-format="yyyy-MM-dd"
  25. :placeholder="$t(`选择发货日期`)"
  26. size="small"
  27. :picker-options="pickerOptions">
  28. </el-date-picker>
  29. </div>
  30. <div class="flex-align-center normal-margin">
  31. <div style="flex:1;margin-right:10px">
  32. <div class="mt-10">
  33. <p class="normal-title inline-16">{{$t(`收货信息`)}}</p>
  34. <el-popover
  35. placement="bottom"
  36. :title="$t(`选择地址`)"
  37. trigger="click"
  38. v-model="visible">
  39. <div class="flex-align-center" style="justify-content:space-between;margin-bottom:10px">
  40. <el-input
  41. size="small"
  42. v-model="addressparam.content.where.condition"
  43. :placeholder="$t('请输入搜索内容')"
  44. style="width:150px"
  45. @keyup.enter.native="receiveAddress(addressparam.content.pageNumber = 1)" @clear="receiveAddress(addressparam.content.pageNumber = 1)" clearable></el-input>&nbsp;
  46. <addAddressInfo style="text-align:right" @onAddSuccess="receiveAddress()" :mainData="{sys_enterpriseid:data.sys_enterpriseid}"/>
  47. </div>
  48. <el-table
  49. :data="receiveAddresslist"
  50. style="width: 100%"
  51. size="mini">
  52. <el-table-column
  53. prop="name"
  54. :label="$t('联系人')"
  55. width="90">
  56. </el-table-column>
  57. <el-table-column
  58. prop="phonenumber"
  59. :label="$t(`电话`)"
  60. width="120">
  61. </el-table-column>
  62. <el-table-column
  63. :label="$t('地址')"
  64. width="360">
  65. <template slot-scope="scope">
  66. {{scope.row.province}}{{scope.row.city}}{{scope.row.county}}{{scope.row.address}}
  67. </template>
  68. </el-table-column>
  69. <el-table-column
  70. :label="$t('操作')"
  71. width="120">
  72. <template slot-scope="scope">
  73. <el-button class="inline-16" type="text" @click="(defaultData.re_info = scope.row,visible = false)" size="mini">{{$t('选 择')}}</el-button>
  74. <el-popconfirm :confirm-button-text="$t('确定')" :cancel-button-text="$t('取消')"
  75. :title="$t(`确定删除吗?`)"
  76. @confirm="deleteContacts(scope.row)">
  77. <el-button class="inline-16" size="small" type="text" slot="reference">{{$t('删 除')}}</el-button>
  78. </el-popconfirm>
  79. </template>
  80. </el-table-column>
  81. </el-table>
  82. <div class="container" style="text-align:right">
  83. <el-pagination
  84. background
  85. small
  86. :current-page="addressparam.content.pageNumber"
  87. @current-change="addresPageChange"
  88. layout="total,prev, pager, next"
  89. :total="addresstotal">
  90. </el-pagination>
  91. </div>
  92. <el-button slot="reference" type="text" size="mini">{{$t(`选择其他地址`)}}</el-button>
  93. </el-popover>
  94. </div>
  95. <div class="reveive__panel normal-margin">
  96. <p><span class="inline-16"><b>{{defaultData.re_info.name}}</b></span><small>{{defaultData.re_info.phonenumber}}</small></p>
  97. <small>{{defaultData.re_info.province}}{{defaultData.re_info.city}}{{defaultData.re_info.county}}{{defaultData.re_info.address?defaultData.re_info.address:'--'}}</small>
  98. </div>
  99. </div>
  100. </div>
  101. <div class="mt-10" v-if="tool.checkAuth($route.name,'updShipping')">
  102. <p class="normal-title inline-16">{{$t(`运费方式`)}}</p>
  103. </div>
  104. <div class="mt-10 flex-align-center" v-if="tool.checkAuth($route.name,'updShipping')">
  105. <div :style="defaultData.freightstatus === '到付'?{background:'#d9ecff'}:{background:'#fff'}" class="reveive__panel normal-margin inline-16" @click="defaultData.freightstatus = '到付'">
  106. <p>{{$t(`到付`)}}</p>
  107. </div>
  108. <div :style="defaultData.freightstatus === '预付'?{background:'#d9ecff'}:{background:'#fff'}" class="reveive__panel normal-margin" @click="defaultData.freightstatus = '预付'">
  109. <p>{{$t(`预付`)}}</p>
  110. </div>
  111. </div>
  112. <div class="mt-10">
  113. <p class="normal-title inline-16">{{$t(`备注`)}}</p>
  114. </div>
  115. <el-input style="margin-bottom:10px" v-model="defaultData.remarks" :placeholder="$t(`请输入备注`)"></el-input>
  116. <div class="mt-10">
  117. <div>
  118. <p class="normal-title inline-16">{{$t(`发货单产品`)}}</p>
  119. <!-- <el-button type="text" size="mini" @click="addMoreProduct">{{setcol === 12?'关闭选择':'添加发货产品'}}</el-button>-->
  120. </div>
  121. <el-row :gutter="10">
  122. <el-col :span="setcol">
  123. <product-list ref="prolist" :type="'edit'" :data="data" @onSuccess="onDelSuccess"></product-list>
  124. </el-col>
  125. <el-col :span="24 - setcol">
  126. <add-disProduct ref="addpro" :data="data" @onConfirm="onConfirm"></add-disProduct>
  127. </el-col>
  128. </el-row>
  129. </div>
  130. </div>
  131. <div class="fixed__btn__panel">
  132. <el-button size="small" @click="drawer = false" class="normal-btn-width">{{$t('取 消')}}</el-button>
  133. <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">{{$t(`保存修改`)}}</el-button>
  134. </div>
  135. </el-drawer>
  136. </div>
  137. </template>
  138. <script>
  139. import previewImage from '@/components/previewImage/index.vue'
  140. import productList from './productlist.vue'
  141. import addDisProduct from '@/template/disCanUseProduct/index.vue'
  142. import addAddressInfo from '@/HManagement/marketing2/agent/details/modules/address/add'
  143. export default {
  144. props:['data'],
  145. components:{
  146. previewImage,
  147. productList,
  148. addDisProduct,
  149. addAddressInfo
  150. },
  151. data () {
  152. return {
  153. visible:false,
  154. visible1:false,
  155. drawer:false,
  156. logisticcomlist:[],
  157. receiveAddresslist:[],
  158. defaultData:{
  159. re_info:{},
  160. logist_info:{},
  161. billdate:(new Date()).toISOString().split('T')[0],
  162. freightstatus:'',
  163. remarks:''
  164. },
  165. setcol:24,
  166. pickerOptions: {
  167. disabledDate(time) {
  168. return time.getTime() < (Date.now() - 24 * 3600 * 1000);
  169. },
  170. },
  171. addressparam: {
  172. "id": "20221009155803",
  173. "content": {
  174. "nocache":true,
  175. "pageNumber":1,
  176. "pageSize":10,
  177. "sys_enterpriseid":'',
  178. "where":{
  179. "condition":"",
  180. "workaddress":1
  181. }
  182. }
  183. },
  184. addresstotal:0,
  185. siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid
  186. }
  187. },
  188. methods:{
  189. addresPageChange (n) {
  190. this.addressparam.content.pageNumber = n
  191. this.receiveAddress()
  192. },
  193. onShow () {
  194. this.receiveAddress()
  195. this.queryLogisticcom()
  196. this.defaultData.freightstatus = this.data.freightstatus
  197. this.defaultData.billdate = this.data.billdate?this.data.billdate:this.siteid == 'YOSTEST1' || this.siteid == 'HY'?'':(new Date()).toISOString().split('T')[0]
  198. this.defaultData.remarks = this.data.remarks
  199. },
  200. async deleteContacts (row) {
  201. const res = await this.$api.requested({
  202. "id": "20221009155903",
  203. "version":1,
  204. "content": {
  205. "contactsids":[row.contactsid]
  206. }
  207. })
  208. this.tool.showMessage(res,()=>{
  209. this.receiveAddress()
  210. })
  211. },
  212. // 收货信息:合作企业联系人
  213. async receiveAddress () {
  214. this.addressparam.content.sys_enterpriseid = this.data.sys_enterpriseid
  215. const res = await this.$api.requested(this.addressparam)
  216. this.receiveAddresslist = res.data
  217. this.addresstotal = res.total
  218. this.defaultData.re_info = this.data.recvice
  219. },
  220. // 物流企业
  221. async queryLogisticcom () {
  222. const res = await this.$api.requested({
  223. "id": "20221121135804",
  224. "content": {
  225. "pageNumber": 1,
  226. "pageSize": 100
  227. }
  228. })
  229. this.logisticcomlist = res.data
  230. this.defaultData.logist_info = this.data.logiscomp
  231. },
  232. async onSubmit() {
  233. console.log(this.data)
  234. if (!this.defaultData.billdate){
  235. this.$confirm('请填写发货时间!', '提示', {
  236. showCancelButton:false,
  237. confirmButtonText: '确定',
  238. type: 'warning'
  239. }).then(() => {
  240. }).catch(() => {
  241. });
  242. }else {
  243. const res = await this.$api.requested({
  244. "id": 20221114135203,
  245. "content": {
  246. "sa_dispatchid":this.data.sa_dispatchid,
  247. "sa_orderid":0,
  248. "sys_enterpriseid":this.data.sys_enterpriseid,
  249. "rec_contactsid":this.defaultData.re_info.contactsid,
  250. "billdate":this.defaultData.billdate,
  251. "freightstatus":this.defaultData.freightstatus,
  252. "remarks":this.defaultData.remarks
  253. },
  254. })
  255. this.tool.showMessage(res,()=>{
  256. this.$emit('onSuccess')
  257. this.drawer = false
  258. })
  259. }
  260. },
  261. onDelSuccess () {
  262. this.$refs.addpro.listData()
  263. this.$emit('onSuccess')
  264. },
  265. addMoreProduct () {
  266. this.setcol === 12?this.setcol = 24 : this.setcol = 12
  267. },
  268. // 订单添加商品
  269. async onConfirm (data) {
  270. const res = await this.$api.requested({
  271. "id": 20221115104603,
  272. "content": {
  273. "sa_dispatchid": this.$route.query.id, //订单ID
  274. "iteminfos":data.map(e=>{
  275. e.sa_dispatch_itemsid = 0
  276. e.remarks = ''
  277. e.qty=e.undeliqty
  278. return e
  279. })
  280. },
  281. })
  282. this.tool.showMessage(res,()=>{
  283. this.$refs.prolist.listData()
  284. this.$refs.addpro.listData()
  285. this.$emit('onSuccess')
  286. })
  287. }
  288. },
  289. mounted () {
  290. }
  291. }
  292. </script>
  293. <style>
  294. </style>
  295. <style scoped>
  296. .reveive__panel{
  297. font-size: 14px;
  298. line-height: 30px;
  299. padding: 10px;
  300. background: #d9ecff;
  301. border: 1px dashed #0676e7;
  302. }
  303. .account__panel small,.reveive__panel small{
  304. color:#666
  305. }
  306. .account__panel{
  307. width: calc(33% - 26px);
  308. padding: 10px;
  309. margin-bottom:10px;
  310. border: 1px dashed #666;
  311. }
  312. .act{
  313. background: #d9ecff;
  314. border: 1px dashed #0676e7;
  315. }
  316. .image {
  317. width:40px;height:40px;margin:0px auto;
  318. }
  319. .order__note__input{
  320. border: none;
  321. outline: none;
  322. /* margin-left: 10px; */
  323. /* border-bottom: 1px solid #f1f2f3; */
  324. flex:1
  325. }
  326. </style>