shipmentPatchworkPage.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465
  1. <template>
  2. <gui-page :custom-header="true" :header-class="['gui-theme-background-color']">
  3. <template #gHeader>
  4. <view style="height:44px;" class="gui-flex gui-nowrap gui-rows gui-align-items-center">
  5. <!-- 使用组件实现返回按钮及返回首页按钮 -->
  6. <text style="font-size:44rpx;" class="gui-header-leader-btns gui-color-white font-icons"
  7. @tap="goHome">&#xe6c5;</text>
  8. <!-- 导航文本此处也可以是其他自定义内容 -->
  9. <text
  10. class="gui-h4 gui-blod gui-flex1 gui-text-center gui-ellipsis gui-color-white gui-primary-text">出货单列表</text>
  11. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  12. <!-- 实际宽度请根据自己情况设置 -->
  13. <view style="width:40px;" />
  14. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  15. </view>
  16. </template>
  17. <template #gBody>
  18. <view class="list-content">
  19. <view class="search">
  20. <view class="search-card">
  21. <text>销售状态</text>
  22. <view class="custom-select">
  23. <uni-data-select v-model="queryParams.saleStatus" :localdata="selectList"
  24. @change="handleSelected" />
  25. </view>
  26. </view>
  27. </view>
  28. <view class="scan">
  29. <view class="scan-card">
  30. <uni-easyinput ref="easyinput" v-model="scanNumber" :input-border="false" :clearable="false"
  31. type="text" focus @focus="handleInputFocus" placeholder="扫描外部标签" @confirm="handleKeydown" />
  32. <text class="font-icons icon-scan" @click="handleMapass">&#xe6b7;</text>
  33. </view>
  34. </view>
  35. <view class="collapsed-panel" v-if="cardList?.length > 0">
  36. <view class="panel" v-for="item in cardList">
  37. <uni-collapse>
  38. <uni-collapse-item open :show-animation="true">
  39. <template v-slot:title>
  40. <div class="top">
  41. <div class="panel-row">
  42. <span>出货货单</span>
  43. <span>{{ item.saleOutNo }}</span>
  44. </div>
  45. <div class="panel-row">
  46. <span>客户</span>
  47. <span>{{ item.customerName }}</span>
  48. </div>
  49. </div>
  50. </template>
  51. <div class="content" v-for="detail in item?.detail"
  52. @click="handleNavigateToInfoDetail(item, detail)">
  53. <div class="panel-row">
  54. <span>生产订单</span>
  55. <span>{{ detail.workOrderNo }}</span>
  56. </div>
  57. <div class="panel-row">
  58. <span>产品名称</span>
  59. <span>{{ detail.materialName }}</span>
  60. </div>
  61. <div class="panel-row">
  62. <span>出货数量</span>
  63. <span>{{ detail.deliveredQty }}</span>
  64. </div>
  65. <span class="font-icons">&#xe66b;</span>
  66. </div>
  67. </uni-collapse-item>
  68. </uni-collapse>
  69. </view>
  70. </view>
  71. <view v-else>
  72. <view class="bg-image">
  73. <image src="@/static/empty.png" mode="heightFix" />
  74. <text>这里什么都没有...</text>
  75. </view>
  76. </view>
  77. </view>
  78. <uni-popup ref="errorTip" type="dialog">
  79. <uni-popup-dialog type="error" cancel-text="关闭" confirm-text="确认" title="提示" :content="errorTipMessage"
  80. @confirm="handleCloseErrorTipsModal" @close="handleCloseErrorTipsModal" />
  81. </uni-popup>
  82. </template>
  83. </gui-page>
  84. </template>
  85. <script>
  86. import {
  87. defineComponent,
  88. onBeforeMount,
  89. ref
  90. } from 'vue'
  91. import {
  92. onReachBottom
  93. } from '@dcloudio/uni-app'
  94. export default defineComponent({
  95. setup() {
  96. const modalForm = ref('')
  97. const errorState = ref(0)
  98. const easyinput = ref()
  99. const errorTip = ref('')
  100. const errorTipMessage = ref('')
  101. const cardList = ref([])
  102. const scanNumber = ref('')
  103. const queryParams = ref({
  104. pageSize: 10,
  105. pageNo: 1,
  106. saleStatus: ''
  107. })
  108. const selectList = ref([{
  109. text: '待出库',
  110. value: 0
  111. },
  112. {
  113. text: '未完成',
  114. value: 1
  115. },
  116. {
  117. text: '已完成',
  118. value: 2
  119. }
  120. ])
  121. onBeforeMount(() => {
  122. search()
  123. })
  124. const search = function() {
  125. uni.$reqGet("getSaleOutOrderMasterList", queryParams.value)
  126. .then(({
  127. code,
  128. data,
  129. msg
  130. }) => {
  131. if (code === 0) {
  132. cardList.value = data?.list ?? []
  133. } else {
  134. // #ifdef APP-PLUS
  135. plus.device.beep(2)
  136. // #endif
  137. errorTipMessage.value = msg
  138. errorTip.value.open()
  139. errorState.value = -1
  140. }
  141. })
  142. }
  143. const handleMapass = function() {
  144. // #ifdef APP-PLUS
  145. const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
  146. mpaasScanModule.mpaasScan({
  147. // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
  148. 'scanType': ['qrCode', 'barCode'],
  149. // 是否隐藏相册,默认false不隐藏
  150. 'hideAlbum': false
  151. },
  152. (ret) => {
  153. if (ret.resp_code === 1000) {
  154. uni.$reqGet('getShippingLabelByScan', {
  155. qrCode: ret.resp_result
  156. })
  157. .then(({
  158. code,
  159. data,
  160. msg
  161. }) => {
  162. if (code === 0) {
  163. uni.navigateTo({
  164. url: `/pages/workbranch/production/shipment/shipmentOrderInfoDetails?params=${JSON.stringify(data)}`
  165. })
  166. } else {
  167. // #ifdef APP-PLUS
  168. plus.device.beep(2)
  169. // #endif
  170. errorTipMessage.value = msg
  171. errorTip.value.open()
  172. errorState.value = 0
  173. }
  174. })
  175. }
  176. })
  177. // #endif
  178. }
  179. // 扫描完成品标签输入框回车事件
  180. const handleKeydown = function(e) {
  181. uni.$reqGet('getShippingLabelByScan', {
  182. qrCode: e
  183. })
  184. .then(({
  185. code,
  186. data,
  187. msg
  188. }) => {
  189. if (code === 0) {
  190. uni.navigateTo({
  191. url: `/pages/workbranch/production/shipment/shipmentOrderInfoDetails?params=${JSON.stringify(data)}`
  192. })
  193. } else {
  194. // #ifdef APP-PLUS
  195. plus.device.beep(2)
  196. // #endif
  197. errorTipMessage.value = msg
  198. errorTip.value.open()
  199. errorState.value = 0
  200. }
  201. })
  202. }
  203. const goHome = function() {
  204. uni.$goHome()
  205. }
  206. const setInputFocus = function() {
  207. scanNumber.value = ''
  208. easyinput.value.onBlur()
  209. easyinput.value.onFocus()
  210. }
  211. // 关闭错误信息弹窗
  212. const handleCloseErrorTipsModal = async function() {
  213. errorTip.value.close()
  214. if (errorState.value === 0) {
  215. await setInputFocus()
  216. }
  217. }
  218. // 禁用软键盘
  219. const handleInputFocus = function() {
  220. // #ifdef APP-PLUS
  221. setTimeout(() => {
  222. uni.hideKeyboard()
  223. }, 100)
  224. // #endif
  225. }
  226. const handleNavigateToInfoDetail = function(parent, detail) {
  227. const parentData = JSON.parse(JSON.stringify(parent))
  228. Reflect.deleteProperty(parentData, 'detail');
  229. const params = {
  230. ...parentData,
  231. detail
  232. }
  233. uni.navigateTo({
  234. url: `/pages/workbranch/production/shipment/shipmentOrderInfoDetails?params=${JSON.stringify(params)}`
  235. })
  236. }
  237. const handleSelected = function(data) {
  238. queryParams.value.pageNo = 1
  239. if (![NaN, null, undefined].includes(data)) {
  240. queryParams.value.saleStatus = data
  241. cardList.value = []
  242. }
  243. search()
  244. }
  245. // uniapp移动端触底事件
  246. onReachBottom(() => {
  247. queryParams.value.pageNo += 1
  248. uni.$reqGet('getSaleOutOrderMasterList', queryParams.value)
  249. .then(({
  250. code,
  251. data,
  252. msg
  253. }) => {
  254. if (code === 0) {
  255. Array.prototype.push.call(cardList.value, ...data?.list ?? [])
  256. } else {
  257. // #ifdef APP-PLUS
  258. plus.device.beep(2)
  259. // #endif
  260. errorTipMessage.value = msg
  261. errorTip.value.open()
  262. errorState.value = -1
  263. }
  264. })
  265. })
  266. return {
  267. options: [{
  268. text: '删除',
  269. style: {
  270. backgroundColor: '#dd524d'
  271. }
  272. }],
  273. goHome,
  274. easyinput,
  275. errorTip,
  276. errorTipMessage,
  277. queryParams,
  278. cardList,
  279. selectList,
  280. modalForm,
  281. scanNumber,
  282. handleMapass,
  283. handleKeydown,
  284. handleInputFocus,
  285. handleSelected,
  286. handleNavigateToInfoDetail,
  287. handleCloseErrorTipsModal
  288. }
  289. }
  290. })
  291. </script>
  292. <style lang="scss" scoped>
  293. .gui-header-leader-btns {
  294. color: black;
  295. margin-left: 24rpx;
  296. font-size: 24px !important;
  297. }
  298. .list-content {
  299. margin-top: 120px;
  300. min-height: calc(100vh - 80px);
  301. background-color: #edeeee;
  302. }
  303. .input-200 {
  304. width: 200px;
  305. padding-left: 10px;
  306. }
  307. .icon-scan {
  308. font-size: 20px;
  309. text-align: right;
  310. }
  311. .scan {
  312. height: 45px;
  313. width: calc(100% - 48px);
  314. margin: 12px;
  315. padding: 0 12px;
  316. display: flex;
  317. justify-content: space-between;
  318. align-items: center;
  319. border-radius: 6px;
  320. background-color: white;
  321. .scan-card {
  322. width: 100%;
  323. display: grid;
  324. grid-template-rows: 1fr;
  325. grid-template-columns: 7fr 2fr;
  326. align-items: center;
  327. input {
  328. height: 35px;
  329. line-height: 35px;
  330. }
  331. text {
  332. width: 100%;
  333. text-align: right;
  334. }
  335. }
  336. }
  337. span,
  338. text {
  339. font-size: 12px;
  340. }
  341. .collapsed-panel {
  342. // height: calc(100vh - 190px);
  343. // min-height: 230px;
  344. margin: 5px 0;
  345. padding: 0 8px;
  346. overflow-y: scroll;
  347. .panel {
  348. position: relative;
  349. margin: 8px 0;
  350. .top {
  351. font-weight: bold;
  352. border-top-left-radius: 4px;
  353. border-top-right-radius: 4px;
  354. background-color: white;
  355. .panel-row {
  356. line-height: 32px;
  357. padding: 0 12px;
  358. display: flex;
  359. justify-content: space-between;
  360. span:nth-of-type(1) {
  361. min-width: 30%;
  362. }
  363. span:nth-of-type(2) {
  364. min-width: 30%;
  365. padding-right: 8px;
  366. text-align: right;
  367. word-wrap: break-word;
  368. overflow-y: scroll;
  369. }
  370. span {
  371. color: rgba(0, 160, 233, 1);
  372. }
  373. }
  374. }
  375. .content {
  376. position: relative;
  377. overflow-y: scroll;
  378. border-top: 2px dashed rgba(237, 238, 238, 1);
  379. .panel-row {
  380. // height: 32px;
  381. line-height: 32px;
  382. padding: 0 12px;
  383. display: flex;
  384. justify-content: space-between;
  385. background-color: #fbfbfb;
  386. span:nth-of-type(1) {
  387. min-width: 30%;
  388. }
  389. span:nth-of-type(2) {
  390. min-width: 30%;
  391. padding-right: 8px;
  392. text-align: right;
  393. word-wrap: break-word;
  394. overflow-y: scroll;
  395. }
  396. }
  397. .font-icons {
  398. position: absolute;
  399. right: 2px;
  400. top: 50%;
  401. transform: translate(0, -50%);
  402. z-index: 1;
  403. }
  404. }
  405. }
  406. }
  407. .search {
  408. position: fixed;
  409. top: 79px;
  410. left: 0;
  411. height: 45px;
  412. width: 100%;
  413. padding: 0 12px 0 24px;
  414. z-index: 9;
  415. display: flex;
  416. justify-content: space-between;
  417. align-items: center;
  418. box-sizing: border-box;
  419. border-bottom: 1px solid #edeeee;
  420. background-color: white;
  421. .search-card {
  422. width: 100%;
  423. display: grid;
  424. grid-template-rows: 1fr;
  425. grid-template-columns: 5fr 7fr;
  426. align-items: center;
  427. }
  428. }
  429. </style>