OutboundTask_XQ.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377
  1. <template>
  2. <view>
  3. <view style="background: #fff;width: 94%;margin: 20rpx auto;">
  4. <view class="popupbox">
  5. <view class="formBox">
  6. <view class="inputBox">
  7. <view style="color: #dd451b;display: flex;align-items: center;">
  8. <u-icon name="file-text" color="#dd451b" size="18"></u-icon>
  9. <text style="margin-left: 8rpx;">销售单号</text>
  10. </view>
  11. <view class="huicolor">{{popupRow.ordNo}}</view>
  12. </view>
  13. <view class="inputBox">
  14. <view style="color: #dd451b;display: flex;align-items: center;">
  15. <u-icon name="account" color="#dd451b" size="18"></u-icon>
  16. <text style="margin-left: 8rpx;">业务对象</text>
  17. </view>
  18. <view class="huicolor">{{popupRow.customerName}}</view>
  19. </view>
  20. <view class="inputBox">
  21. <view style="color: #dd451b;display: flex;align-items: center;">
  22. <u-icon name="edit-pen" color="#dd451b" size="18"></u-icon>
  23. <text style="margin-left: 8rpx;">业务来源</text>
  24. </view>
  25. <view class="huicolor">{{popupRow.bsType}}</view>
  26. </view>
  27. <view class="inputBox">
  28. <view style="color: #dd451b;display: flex;align-items: center;">
  29. <u-icon name="home" color="#dd451b" size="18"></u-icon>
  30. <text style="margin-left: 8rpx;">来源公司</text>
  31. </view>
  32. <view class="huicolor">{{popupRow.sourceCompanyName}}</view>
  33. </view>
  34. <view class="inputBox">
  35. <view style="color: #dd451b;display: flex;align-items: center;">
  36. <u-icon name="map" color="#dd451b" size="18"></u-icon>
  37. <text style="margin-left: 8rpx;">收货地址</text>
  38. </view>
  39. <view class="huicolor">{{popupRow.recAddress}}</view>
  40. </view>
  41. <view class="inputBox">
  42. <view style="color: #dd451b;display: flex;align-items: center;">
  43. <u-icon name="coupon" color="#dd451b" size="18"></u-icon>
  44. <text style="margin-left: 8rpx;">销售数量</text>
  45. </view>
  46. <view class="huicolor">{{popupRow.goodsTotalNum}}</view>
  47. </view>
  48. <view class="inputBox">
  49. <view style="color: #dd451b;display: flex;align-items: center;">
  50. <u-icon name="coupon" color="#dd451b" size="18"></u-icon>
  51. <text style="margin-left: 8rpx;">发货数量</text>
  52. </view>
  53. <view class="huicolor">{{popupRow.sendTotalNum?popupRow.sendTotalNum:'--'}}</view>
  54. </view>
  55. <view class="inputBox">
  56. <view style="color: #dd451b;display: flex;align-items: center;">
  57. <u-icon name="account" color="#dd451b" size="18"></u-icon>
  58. <text style="margin-left: 8rpx;">联系人</text>
  59. </view>
  60. <view class="huicolor">{{popupRow.contacts}}</view>
  61. </view>
  62. <view class="inputBox">
  63. <view style="color: #dd451b;display: flex;align-items: center;">
  64. <u-icon name="phone" color="#dd451b" size="18"></u-icon>
  65. <text style="margin-left: 8rpx;">电话</text>
  66. </view>
  67. <view class="huicolor">{{popupRow.phone}}</view>
  68. </view>
  69. </view>
  70. </view>
  71. </view>
  72. <view style="background: #fff;width: 94%;margin: 20rpx auto;">
  73. <view class="popupbox">
  74. <view class="formBox">
  75. <view class="inputBox" @click="tanchuangfun()">
  76. <view style="color: #dd451b;display: flex;align-items: center;">
  77. <u-icon name="car" color="#dd451b" size="18"></u-icon>
  78. <text style="margin-left: 8rpx;">发货仓库</text>
  79. </view>
  80. <u--input
  81. placeholder="请选择发货仓库"
  82. border="none"
  83. inputAlign="right"
  84. disabled
  85. disabledColor="#fff"
  86. v-model="popupRow.storageName"
  87. ></u--input>
  88. <!-- <view>{{popupRow.storageName}}</view> -->
  89. </view>
  90. <view class="inputBox" @click="KGtanchuangfun()">
  91. <view style="color: #dd451b;display: flex;align-items: center;">
  92. <u-icon name="phone" color="#dd451b" size="18"></u-icon>
  93. <text style="margin-left: 8rpx;">库管</text>
  94. </view>
  95. <u--input
  96. placeholder="请选择库管"
  97. border="none"
  98. inputAlign="right"
  99. disabled
  100. disabledColor="#fff"
  101. v-model="popupRow.stockClerkName"
  102. ></u--input>
  103. <!-- <view v-else>{{popupRow.stockClerkName}}</view> -->
  104. </view>
  105. <view class="inputBox">
  106. <view style="width: 100rpx;color: #dd451b;">备注</view>
  107. <view style="width: 100%;">
  108. <u--textarea v-model="popupRow.remarks" border="none" :disabled="popupType && role_name != -1"
  109. placeholder="请输入备注" ></u--textarea>
  110. </view>
  111. <!-- <view>{{popupRow.remarks?popupRow.remarks:'--'}}</view> -->
  112. </view>
  113. </view>
  114. </view>
  115. </view>
  116. <view style="position: fixed;
  117. bottom: 0;width: 100%;
  118. background: #fff;
  119. border-top-left-radius: 14rpx;
  120. border-top-right-radius: 14rpx;
  121. overflow: hidden;
  122. box-sizing: border-box;" v-if="role_name == -1">
  123. <view class="bottomflex" >
  124. <view style="width: 50%;background: #5ac725;" class="buttombox" @click="popupShowfalse">取消</view>
  125. <view style="width: 50%;" v-if="popupRow.statusName != '已完成'">
  126. <view v-if="popupRow.statusName == '已派工'" class="buttombox"
  127. @click.stop="DispatchingWorkersfun(popupRow,'撤销派工')">撤销派工</view>
  128. <view v-else class="buttombox"
  129. @click.stop="shipEditfun(popupRow)">派工</view>
  130. </view>
  131. </view>
  132. </view>
  133. <!-- 发货仓库选择弹窗 -->
  134. <u-picker :show="pickerShow" :columns="pickerColumns"
  135. keyName="cname" :loading="loading"
  136. @confirm="pickerConfirm" @cancel="pickerCancel"></u-picker>
  137. <!-- 库管选择弹窗 -->
  138. <u-picker :show="KGpickerShow" :columns="KGpickerColumns"
  139. keyName="name" :loading="loading"
  140. @confirm="KGpickerConfirm" @cancel="KGpickerCancel"></u-picker>
  141. <!-- 提示确认弹窗 -->
  142. <u-modal :show="modalShow" :title="modalTitle" :content='modalContent'
  143. showCancelButton @confirm="modalConfirm" @cancel="modalCancel"></u-modal>
  144. <u-overlay :show="overlayShow" zIndex="10076" ></u-overlay>
  145. <u-toast ref="uToast"></u-toast>
  146. </view>
  147. </template>
  148. <script>
  149. import { shipList,storageDescListAll,
  150. stockClerkList,shipEdit,shipOutboundWorkOrder,shipRevokeWorkOrder } from '@/api/OutboundTask/index.js'
  151. export default {
  152. data(){
  153. return {
  154. // 修改的数据
  155. popupRow:{},
  156. // 当前编辑弹窗的下标
  157. popupIndex:0,
  158. // 发货仓库弹窗的开启和关闭
  159. pickerShow:false,
  160. // 发货仓库弹窗的数据
  161. pickerColumns:[],
  162. // 库管弹窗的数据
  163. KGpickerColumns:[],
  164. // 库管弹窗的开启和关闭
  165. KGpickerShow:false,
  166. modalShow:false,
  167. modalTitle:'',
  168. modalContent:'',
  169. // 弹窗是编辑还是详情的判断
  170. popupType:false,
  171. // 弹窗加载
  172. loading:false,
  173. // 判断是否业务员
  174. role_name:null,
  175. overlayShow:false,
  176. }
  177. },
  178. onLoad(e) {
  179. // console.log(uni.getStorageSync('userInfo').role_name.indexOf('业务员'));
  180. this.role_name = uni.getStorageSync('userInfo').role_name.indexOf('业务员')
  181. this.popupRow = JSON.parse(e.row)
  182. if (this.popupRow.statusName == '已派工' || this.popupRow.statusName == '已完成') {
  183. this.popupType = true
  184. }
  185. this.storageDescListAllfun()
  186. this.stockClerkListfun()
  187. },
  188. onShow() {},
  189. methods:{
  190. // 派工,取消派工的弹窗确认按钮
  191. modalConfirm(){
  192. if (this.modalTitle == '派工') {
  193. this.overlayShow = true
  194. shipOutboundWorkOrder({ids:this.popupRow.id}).then(res=>{
  195. if (res.code == 200) {
  196. this.$refs.uToast.show({
  197. type: 'success',
  198. message: "派工成功",
  199. })
  200. this.modalShow = false
  201. this.popupShow = false
  202. this.overlayShow = false
  203. setTimeout(()=>{
  204. this.popupShowfalse()
  205. },1000)
  206. }else {
  207. this.$refs.uToast.show({
  208. type: 'error',
  209. message: res.msg,
  210. })
  211. }
  212. })
  213. }else {
  214. shipRevokeWorkOrder({ids:this.popupRow.id}).then(res=>{
  215. if (res.code == 200) {
  216. this.$refs.uToast.show({
  217. type: 'success',
  218. message: "撤销派工成功"
  219. })
  220. this.modalShow = false
  221. this.popupShow = false
  222. setTimeout(()=>{
  223. this.popupShowfalse()
  224. },1000)
  225. }else {
  226. this.$refs.uToast.show({
  227. type: 'error',
  228. message: res.msg,
  229. })
  230. }
  231. })
  232. }
  233. },
  234. // 派工,取消派工的弹窗取消按钮
  235. modalCancel(){
  236. this.modalShow = false
  237. },
  238. // 派工接口
  239. DispatchingWorkersfun(row,text){
  240. this.modalShow = true
  241. this.popupRow = row
  242. // this.popupIndex = index
  243. this.modalTitle = text
  244. this.modalContent = `是否确认要${text}`
  245. },
  246. // 编辑弹窗取消
  247. popupShowfalse(){
  248. // this.popupShow = false
  249. let pages = getCurrentPages() // 获取当前页面栈的实例,以数组形式按栈的顺序给出,第一个元素为首页,最后一个元素为当前页面。
  250. let prevPage = pages[pages.length - 2] //上一页页面实例
  251. // prevPage.$vm.otherFun(this.form)
  252. uni.navigateBack()
  253. },
  254. // 保存接口
  255. shipEditfun(item){
  256. shipEdit(this.popupRow).then(res=>{
  257. console.log(res,302);
  258. this.DispatchingWorkersfun(item,'派工')
  259. })
  260. },
  261. // 发货仓库相关部分----------------------
  262. // 发货仓库弹窗的确认
  263. pickerConfirm(e){
  264. console.log(e);
  265. this.popupRow.storageName = e.value[0].cname
  266. this.popupRow.storageId = e.value[0].id
  267. this.pickerShow = false
  268. },
  269. // 发货仓库弹窗的打开
  270. tanchuangfun(type){
  271. if (this.role_name != -1) return
  272. if (this.KGpickerShow) return
  273. if (this.popupRow.statusName == '已派工' || this.popupRow.statusName == '已完成') return
  274. this.pickerShow = true
  275. // this.loading = true
  276. // this.pickerColumns = []
  277. // this.storageDescListAllfun()
  278. },
  279. // 发货仓库弹窗的取消
  280. pickerCancel(){
  281. this.pickerShow = false
  282. },
  283. // 获取发货仓库数据
  284. storageDescListAllfun(){
  285. storageDescListAll().then(res=>{
  286. this.pickerColumns = [res.data]
  287. // this.loading = false
  288. })
  289. },
  290. // 库管相关部分------------------------
  291. // 库管弹窗的确认
  292. KGpickerConfirm(e){
  293. this.popupRow.stockClerkName = e.value[0].name
  294. this.popupRow.stockClerkId = e.value[0].id
  295. this.KGpickerShow = false
  296. },
  297. // 库管的弹窗的开启
  298. KGtanchuangfun(){
  299. if (this.role_name != -1) return
  300. if (this.pickerShow) return
  301. if (this.popupRow.statusName == '已派工' || this.popupRow.statusName == '已完成') return
  302. this.KGpickerShow = true
  303. // this.loading = true
  304. // this.stockClerkListfun()
  305. },
  306. // 发货仓库弹窗的取消
  307. KGpickerCancel(){
  308. this.KGpickerShow = false
  309. },
  310. // 获取库管数据
  311. stockClerkListfun(){
  312. stockClerkList().then(res=>{
  313. this.KGpickerColumns = [res.data]
  314. for(let item of res.data) {
  315. if (item.id == this.popupRow.stockClerkId) {
  316. this.popupRow.stockClerkName = item.name
  317. }
  318. }
  319. })
  320. },
  321. }
  322. }
  323. </script>
  324. <style lang="scss" scoped>
  325. .popupbox {
  326. padding: 20rpx;
  327. box-sizing: border-box;
  328. .formBox {
  329. font-size: 30rpx;
  330. .inputBox {
  331. display: flex;
  332. align-items: center;
  333. justify-content: space-between;
  334. border-bottom: 1rpx solid #dcdde0;
  335. padding: 20rpx 0;
  336. margin: 5rpx 0;
  337. }
  338. }
  339. }
  340. .bottomflex {
  341. display: flex;
  342. align-items: center;
  343. // justify-content: space-around;
  344. // margin-top: 30rpx;
  345. .buttombox {
  346. padding: 25rpx 50rpx;
  347. background: #fd4b09;
  348. box-sizing: border-box;
  349. font-size: 30rpx;
  350. color: #fff;
  351. text-align: center;
  352. // border-radius: 12rpx;
  353. }
  354. }
  355. .huicolor {
  356. color: #999;
  357. }
  358. </style>