indexPage.vue 4.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194
  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. >模具保养</text>
  15. <!-- 此处加一个右侧展位元素与左侧同宽,实现标题居中 -->
  16. <!-- 实际宽度请根据自己情况设置 -->
  17. <view style="width:40px;" />
  18. <!-- 如果右侧有其他内容可以利用条件编译和定位来实现-->
  19. </view>
  20. </template>
  21. <template #gBody>
  22. <view class="list-content">
  23. <view class="scan">
  24. <view class="scan-card">
  25. <input
  26. v-model="scanBatchNumber"
  27. class="gui-form-input input-200"
  28. disabled
  29. placeholder="请扫描模具码"
  30. >
  31. <text class="font-icons" @click="handleMapass">&#xe6b7;</text>
  32. </view>
  33. </view>
  34. </view>
  35. </template>
  36. </gui-page>
  37. </template>
  38. <script>
  39. import {
  40. ref,
  41. defineComponent
  42. } from 'vue'
  43. export default defineComponent({
  44. setup() {
  45. const scanBatchNumber = ref('')
  46. const goHome = function() {
  47. uni.$goHome()
  48. }
  49. const handleMapass = function() {
  50. // #ifdef APP-PLUS
  51. const mpaasScanModule = uni.requireNativePlugin('Mpaas-Scan-Module')
  52. mpaasScanModule.mpaasScan({
  53. // 扫码识别类型,参数可多选,qrCode、barCode,不设置,默认识别所有
  54. 'scanType': ['qrCode', 'barCode'],
  55. // 是否隐藏相册,默认false不隐藏
  56. 'hideAlbum': false
  57. },
  58. (ret) => {
  59. if (ret.resp_code === 1000) {
  60. uni.setStorageSync('toolingId', ret.resp_result)
  61. uni.navigateTo({
  62. url: '/pages/workbranch/ETM/moldPreserve/moldDetails'
  63. })
  64. }
  65. })
  66. // #endif
  67. // #ifdef H5
  68. uni.setStorageSync('toolingId', '01020010')
  69. uni.navigateTo({
  70. url: '/pages/workbranch/ETM/moldPreserve/moldDetails'
  71. })
  72. // #endif
  73. }
  74. return {
  75. goHome,
  76. scanBatchNumber,
  77. handleMapass
  78. }
  79. }
  80. })
  81. </script>
  82. <style lang="scss" scoped>
  83. .gui-header-leader-btns {
  84. color: black;
  85. font-size: 24px !important;
  86. margin-left: 24rpx;
  87. }
  88. .list-content {
  89. margin-top: 80px;
  90. background-color: #edeeee;
  91. }
  92. .card-list-flexbox {
  93. display: flex;
  94. flex-direction: row;
  95. align-items: center;
  96. flex-wrap: wrap;
  97. margin: 3px 2px;
  98. .card-list-item {
  99. width: 750rpx;
  100. height: 40px;
  101. margin: 2rpx 0;
  102. display: flex;
  103. flex-direction: row;
  104. align-items: center;
  105. justify-content: space-between;
  106. background-color: #fff;
  107. uni-text {
  108. font-size: 14px;
  109. height: 50rpx;
  110. text-align: left;
  111. padding: 0 12px;
  112. display: flex;
  113. flex-direction: row;
  114. align-items: center;
  115. }
  116. .text-1 {
  117. flex: 1;
  118. height: 40px;
  119. justify-content: flex-start;
  120. }
  121. .text-2 {
  122. flex: 3;
  123. height: 40px;
  124. justify-content: flex-end;
  125. margin-right: 4px;
  126. padding: 2px 6px;
  127. }
  128. }
  129. .card-list-item:nth-of-type(1) {
  130. .text-1 {
  131. flex: 9;
  132. font-weight: bold;
  133. color: black !important;
  134. }
  135. .text-2 {
  136. flex: 4;
  137. display: flex;
  138. flex-direction: row;
  139. justify-content: flex-end;
  140. align-items: center;
  141. color: limegreen !important;
  142. }
  143. }
  144. }
  145. .font-icons {
  146. width: 40px;
  147. font-size: 20px;
  148. }
  149. .scan {
  150. height: 45px;
  151. width: calc(100% - 48px);
  152. margin: 12px;
  153. padding: 0 12px;
  154. display: flex;
  155. justify-content: space-between;
  156. align-items: center;
  157. border-radius: 6px;
  158. background-color: white;
  159. .scan-card {
  160. width: 100%;
  161. display: grid;
  162. grid-template-rows: 1fr;
  163. grid-template-columns: 7fr 2fr;
  164. align-items: center;
  165. input {
  166. height: 35px;
  167. line-height: 35px;
  168. }
  169. text {
  170. width: 100%;
  171. text-align: right;
  172. }
  173. }
  174. }
  175. </style>