shipmentPage.vue 11 KB

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