edit.vue 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335
  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:20px" v-model="defaultData.remarks" :placeholder="$t(`请输入对外备注`)"></el-input>
  116. <div class="mt-10" v-if="tool.checkAuth($route.name,'internalNote')">
  117. <p class="normal-title inline-16">{{$t(`对内备注`)}}</p>
  118. </div>
  119. <el-input style="margin-bottom:20px" v-model="defaultData.remarks_in" v-if="tool.checkAuth($route.name,'internalNote')" :placeholder="$t(`请输入对内备注`)"></el-input>
  120. <div class="mt-10">
  121. <div>
  122. <p class="normal-title inline-16">{{$t(`发货单产品`)}}</p>
  123. <!-- <el-button type="text" size="mini" @click="addMoreProduct">{{setcol === 12?'关闭选择':'添加发货产品'}}</el-button>-->
  124. </div>
  125. <el-row :gutter="10">
  126. <el-col :span="setcol">
  127. <product-list ref="prolist" :type="'edit'" :data="data" @onSuccess="onDelSuccess"></product-list>
  128. </el-col>
  129. <el-col :span="24 - setcol">
  130. <add-disProduct ref="addpro" :data="data" @onConfirm="onConfirm"></add-disProduct>
  131. </el-col>
  132. </el-row>
  133. </div>
  134. </div>
  135. <div class="fixed__btn__panel">
  136. <el-button size="small" @click="drawer = false" class="normal-btn-width">{{$t('取 消')}}</el-button>
  137. <el-button size="small" type="primary" @click="onSubmit" class="normal-btn-width">{{$t(`保存修改`)}}</el-button>
  138. </div>
  139. </el-drawer>
  140. </div>
  141. </template>
  142. <script>
  143. import previewImage from '@/components/previewImage/index.vue'
  144. import productList from './productlist.vue'
  145. import addDisProduct from '@/template/disCanUseProduct/index.vue'
  146. import addAddressInfo from '@/HManagement/marketing2/agent/details/modules/address/add'
  147. export default {
  148. props:['data'],
  149. components:{
  150. previewImage,
  151. productList,
  152. addDisProduct,
  153. addAddressInfo
  154. },
  155. data () {
  156. return {
  157. visible:false,
  158. visible1:false,
  159. drawer:false,
  160. logisticcomlist:[],
  161. receiveAddresslist:[],
  162. defaultData:{
  163. re_info:{},
  164. logist_info:{},
  165. billdate:(new Date()).toISOString().split('T')[0],
  166. freightstatus:'',
  167. remarks:'',
  168. remarks_in:''
  169. },
  170. setcol:24,
  171. pickerOptions: {
  172. disabledDate(time) {
  173. return time.getTime() < (Date.now() - 24 * 3600 * 1000);
  174. },
  175. },
  176. addressparam: {
  177. "id": "20221009155803",
  178. "content": {
  179. "nocache":true,
  180. "pageNumber":1,
  181. "pageSize":10,
  182. "sys_enterpriseid":'',
  183. "where":{
  184. "condition":"",
  185. "workaddress":1
  186. }
  187. }
  188. },
  189. addresstotal:0,
  190. siteid:JSON.parse(sessionStorage.getItem('active_account')).siteid
  191. }
  192. },
  193. methods:{
  194. addresPageChange (n) {
  195. this.addressparam.content.pageNumber = n
  196. this.receiveAddress()
  197. },
  198. onShow () {
  199. this.receiveAddress()
  200. this.queryLogisticcom()
  201. this.defaultData.freightstatus = this.data.freightstatus
  202. this.defaultData.billdate = this.data.billdate?this.data.billdate:this.siteid == 'YOSTEST1' || this.siteid == 'HY'?'':(new Date()).toISOString().split('T')[0]
  203. this.defaultData.remarks = this.data.remarks
  204. this.defaultData.remarks_in = this.data.remarks_in
  205. },
  206. async deleteContacts (row) {
  207. const res = await this.$api.requested({
  208. "id": "20221009155903",
  209. "version":1,
  210. "content": {
  211. "contactsids":[row.contactsid]
  212. }
  213. })
  214. this.tool.showMessage(res,()=>{
  215. this.receiveAddress()
  216. })
  217. },
  218. // 收货信息:合作企业联系人
  219. async receiveAddress () {
  220. this.addressparam.content.sys_enterpriseid = this.data.sys_enterpriseid
  221. const res = await this.$api.requested(this.addressparam)
  222. this.receiveAddresslist = res.data
  223. this.addresstotal = res.total
  224. this.defaultData.re_info = this.data.recvice
  225. },
  226. // 物流企业
  227. async queryLogisticcom () {
  228. const res = await this.$api.requested({
  229. "id": "20221121135804",
  230. "content": {
  231. "pageNumber": 1,
  232. "pageSize": 100
  233. }
  234. })
  235. this.logisticcomlist = res.data
  236. this.defaultData.logist_info = this.data.logiscomp
  237. },
  238. async onSubmit() {
  239. console.log(this.data)
  240. if (!this.defaultData.billdate){
  241. this.$confirm('请填写发货时间!', '提示', {
  242. showCancelButton:false,
  243. confirmButtonText: '确定',
  244. type: 'warning'
  245. }).then(() => {
  246. }).catch(() => {
  247. });
  248. }else {
  249. const res = await this.$api.requested({
  250. "id": 20221114135203,
  251. "content": {
  252. "sa_dispatchid":this.data.sa_dispatchid,
  253. "sa_orderid":0,
  254. "sys_enterpriseid":this.data.sys_enterpriseid,
  255. "rec_contactsid":this.defaultData.re_info.contactsid,
  256. "billdate":this.defaultData.billdate,
  257. "freightstatus":this.defaultData.freightstatus,
  258. "remarks":this.defaultData.remarks,
  259. "remarks_in":this.defaultData.remarks_in
  260. },
  261. })
  262. this.tool.showMessage(res,()=>{
  263. this.$emit('onSuccess')
  264. this.drawer = false
  265. })
  266. }
  267. },
  268. onDelSuccess () {
  269. this.$refs.addpro.listData()
  270. this.$emit('onSuccess')
  271. },
  272. addMoreProduct () {
  273. this.setcol === 12?this.setcol = 24 : this.setcol = 12
  274. },
  275. // 订单添加商品
  276. async onConfirm (data) {
  277. const res = await this.$api.requested({
  278. "id": 20221115104603,
  279. "content": {
  280. "sa_dispatchid": this.$route.query.id, //订单ID
  281. "iteminfos":data.map(e=>{
  282. e.sa_dispatch_itemsid = 0
  283. e.remarks = ''
  284. e.qty=e.undeliqty
  285. return e
  286. })
  287. },
  288. })
  289. this.tool.showMessage(res,()=>{
  290. this.$refs.prolist.listData()
  291. this.$refs.addpro.listData()
  292. this.$emit('onSuccess')
  293. })
  294. }
  295. },
  296. mounted () {
  297. }
  298. }
  299. </script>
  300. <style>
  301. </style>
  302. <style scoped>
  303. .reveive__panel{
  304. font-size: 14px;
  305. line-height: 30px;
  306. padding: 10px;
  307. background: #d9ecff;
  308. border: 1px dashed #0676e7;
  309. }
  310. .account__panel small,.reveive__panel small{
  311. color:#666
  312. }
  313. .account__panel{
  314. width: calc(33% - 26px);
  315. padding: 10px;
  316. margin-bottom:10px;
  317. border: 1px dashed #666;
  318. }
  319. .act{
  320. background: #d9ecff;
  321. border: 1px dashed #0676e7;
  322. }
  323. .image {
  324. width:40px;height:40px;margin:0px auto;
  325. }
  326. .order__note__input{
  327. border: none;
  328. outline: none;
  329. /* margin-left: 10px; */
  330. /* border-bottom: 1px solid #f1f2f3; */
  331. flex:1
  332. }
  333. </style>