展品维保小程序前端代码接口
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

339 lines
8.6 KiB

5 days ago
1 week ago
1 week ago
1 week ago
1 week ago
5 days ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
1 week ago
5 days ago
5 days ago
  1. <template>
  2. <view class="home-container">
  3. <!-- 顶部横幅图片 -->
  4. <view class="banner-section">
  5. <!-- <image class="banner-image" src="@/static/首页背景图.png" mode="aspectFill"></image> -->
  6. <uv-swiper :list="bannerList" :loading="!bannerList.length" height="250"></uv-swiper>
  7. </view>
  8. <!-- 搜索区域 -->
  9. <SearchInput
  10. v-model="searchValue"
  11. placeholder="请输入展品名称"
  12. search-button-text="搜索"
  13. @search="handleSearch"
  14. />
  15. <!-- 展品分类 -->
  16. <view class="category-section" @click="openPicker">
  17. <view class="category-label">{{ selectedCategory.label ||'展品分类' }}</view>
  18. <uv-icon name="arrow-down-fill" size="14" color="#C70019"></uv-icon>
  19. <uv-picker ref="picker" confirmColor="#C70019" :columns="[columns[0], columns[1][0]]" keyName="label" @confirm="onCategoryConfirm" @change="onCategoryChange"></uv-picker>
  20. </view>
  21. <!-- 展品列表 -->
  22. <view class="exhibit-list">
  23. <view class="exhibit-item" v-for="(item, index) in list" :key="index" @click="handleItemClick(item)">
  24. <view class="item-header">
  25. <text class="item-id">{{ item.id }}</text>
  26. <img src="@/static/copy.png" alt="我是复制黏贴" class="item-icon" @click="copyId(item.id)">
  27. </view>
  28. <view class="item-border" />
  29. <view class="item-content">
  30. <view class="content-row">
  31. <text class="name">{{ item.title }}</text>
  32. </view>
  33. <view class="content-row">
  34. <text class="label">展品编号</text>
  35. <text class="value">{{ item.id }}</text>
  36. </view>
  37. <view class="content-row">
  38. <text class="label">展品位置</text>
  39. <text class="value">{{ item.position }}</text>
  40. </view>
  41. <view class="content-row">
  42. <text class="label">展品类型</text>
  43. <text class="value">{{ item.categoryId_dictText }}</text>
  44. </view>
  45. <view class="content-row">
  46. <text class="label">下次保养日期</text>
  47. <text class="value">{{ item.maintenanceDate }}</text>
  48. <view v-if="$utils.calculateDateDifference(item.maintenanceDate) > 0 && $utils.calculateDateDifference(item.maintenanceDate) <= 3" class="project">
  49. {{ $utils.calculateDateDifference(item.maintenanceDate) + '天后维保' }}
  50. </view>
  51. <view v-else-if="$utils.calculateDateDifference(item.maintenanceDate) === -1" class="project">
  52. 已超出维保时间
  53. </view>
  54. <view v-else-if="!$utils.calculateDateDifference(item.maintenanceDate)" class="project">
  55. 当天维修
  56. </view>
  57. </view>
  58. </view>
  59. <view class="item-actions">
  60. <uv-button
  61. size="small"
  62. color="#c70019"
  63. shape="circle"
  64. text="申请报修"
  65. @click.stop="handleRepair(item)"
  66. ></uv-button>
  67. <uv-button
  68. size="small"
  69. text="保养提交"
  70. color="#c70019"
  71. shape="circle"
  72. plain
  73. @click.stop="handleMaintenance(item)"
  74. ></uv-button>
  75. <uv-button
  76. color="#c70019"
  77. shape="circle"
  78. size="small"
  79. text="维修/保养记录"
  80. plain
  81. @click.stop="handleRecord(item)"
  82. ></uv-button>
  83. </view>
  84. </view>
  85. </view>
  86. <!-- 空状态 -->
  87. <uv-empty v-if="!list.length" icon="/static/暂无搜索结果.png" />
  88. </view>
  89. </template>
  90. <script>
  91. import SearchInput from '@/pages/components/SearchInput.vue'
  92. import ListMixin from '@/mixins/list'
  93. export default {
  94. mixins: [ListMixin],
  95. components: {
  96. SearchInput
  97. },
  98. data() {
  99. return {
  100. mixinListApi: 'exhibit.queryShowpieceList',
  101. searchValue: '',
  102. selectedCategory: {
  103. label: '',
  104. value: ''
  105. },
  106. // 轮播图数据
  107. bannerList: [],
  108. }
  109. },
  110. computed: {
  111. // 从状态管理工具中拿分类大数组
  112. columns() {
  113. return this.$store.state.categoryList
  114. }
  115. },
  116. methods: {
  117. handleSearch() {
  118. console.log('搜索的数值为', this.searchValue);
  119. this.initPage()
  120. this.getList(true)
  121. },
  122. mixinSetParams() {
  123. const params = { }
  124. if (this.selectedCategory.value) {
  125. params.categoryId = this.selectedCategory.value
  126. }
  127. return {
  128. title: this.searchValue,
  129. ...params
  130. }
  131. },
  132. openPicker() {
  133. this.$refs.picker.open()
  134. },
  135. onCategoryConfirm(e) {
  136. this.selectedCategory = e.value[1]
  137. console.log('选择分类:', e)
  138. this.initPage()
  139. this.getList(true)
  140. // TODO: 根据分类筛选展品
  141. },
  142. onCategoryChange(e) {
  143. const { columnIndex , index} = e
  144. if (columnIndex === 0) {
  145. this.$refs.picker.setColumnValues(1, this.columns[1][index])
  146. }
  147. },
  148. copyId(id) {
  149. uni.setClipboardData({
  150. data: id,
  151. success: () => {
  152. uni.showToast({
  153. title: '已复制到剪贴板',
  154. icon: 'success'
  155. })
  156. }
  157. })
  158. },
  159. handleItemClick(item) {
  160. console.log('点击展品:', item)
  161. // TODO: 跳转到展品详情页
  162. },
  163. handleRepair(item) {
  164. uni.navigateTo({
  165. url: '/subPages/home/repairSubmit?id=' + item.id
  166. })
  167. // TODO: 跳转到报修页面
  168. },
  169. handleMaintenance(item) {
  170. console.log('保养提交:', item)
  171. uni.navigateTo({
  172. url: '/subPages/home/maintainanceSubmit?id=' + item.id
  173. })
  174. // TODO: 跳转到保养提交页面
  175. },
  176. handleRecord(item) {
  177. console.log('查看记录:', item)
  178. uni.navigateTo({
  179. url: '/subPages/home/RAArecord?id=' + item.id
  180. })
  181. },
  182. async getBannerList() {
  183. const bannerRes = await this.$api.config.queryBannerList()
  184. if (bannerRes.code === 200) {
  185. this.bannerList = bannerRes.result.records.map(item => item.image)
  186. }
  187. },
  188. },
  189. onLoad(){
  190. this.getBannerList()
  191. },
  192. }
  193. </script>
  194. <style lang="scss" scoped>
  195. .home-container {
  196. background-color: #fff;
  197. min-height: 100vh;
  198. }
  199. .banner-section {
  200. width: 100%;
  201. height: 500rpx;
  202. .banner-image {
  203. width: 100%;
  204. height: 100%;
  205. }
  206. }
  207. .category-section {
  208. padding: 20rpx 48rpx;
  209. display: flex;
  210. align-items: center;
  211. justify-content: start;
  212. gap: 9rpx;
  213. .category-label {
  214. font-size: 28rpx;
  215. color: $primary-color;
  216. }
  217. .category-picker {
  218. display: flex;
  219. align-items: center;
  220. padding: 10rpx 20rpx;
  221. border: 1rpx solid #ddd;
  222. border-radius: 8rpx;
  223. background-color: #fafafa;
  224. .category-text {
  225. font-size: 28rpx;
  226. color: #666;
  227. margin-right: 10rpx;
  228. }
  229. }
  230. }
  231. .exhibit-list {
  232. padding: 20rpx 30rpx;
  233. .exhibit-item {
  234. background-color: #fff;
  235. border-radius: 16rpx;
  236. padding: 30rpx 30rpx 45rpx;
  237. margin-bottom: 20rpx;
  238. border-radius: 15rpx;
  239. box-shadow: 0rpx 3rpx 6rpx 0rpx rgba(0,0,0,0.16);
  240. .item-header {
  241. display: flex;
  242. align-items: center;
  243. justify-content: start;
  244. gap: 20rpx;
  245. padding-bottom: 14rpx;
  246. .item-id {
  247. font-size: 28rpx;
  248. color: $secondary-text-color;
  249. }
  250. .item-icon {
  251. width: 25.5rpx;
  252. height: 25.5rpx;
  253. }
  254. }
  255. .item-border {
  256. border-bottom: 1rpx solid $secondary-text-color;
  257. opacity: 0.22;
  258. }
  259. .item-content {
  260. margin-top: 26.5rpx;
  261. margin-bottom: 57rpx;
  262. .content-row {
  263. display: flex;
  264. align-items: center;
  265. margin-bottom: 25rpx;
  266. .name{
  267. font-size: 30rpx;
  268. color: $primary-text-color;
  269. font-weight: bold;
  270. }
  271. &:last-child {
  272. margin-bottom: 0;
  273. }
  274. &:first-child {
  275. margin-bottom: 37rpx;
  276. }
  277. .label {
  278. font-size: 22rpx;
  279. color: $secondary-text-color;
  280. // width: 200rpx;
  281. margin-right: 19rpx;
  282. flex-shrink: 0;
  283. }
  284. .value {
  285. font-size: 22rpx;
  286. color: $primary-text-color;
  287. margin-right: 40rpx;
  288. }
  289. .project {
  290. // flex: 1;
  291. background: $primary-color;
  292. // border: 1px solid #707070;
  293. border-radius: 11rpx;
  294. color: #fff;
  295. font-size: 22rpx;
  296. padding: 6rpx 12rpx;
  297. }
  298. }
  299. }
  300. .item-actions {
  301. margin-left: -10rpx;
  302. display: flex;
  303. gap: 55rpx;
  304. flex-wrap: wrap;
  305. }
  306. }
  307. }
  308. </style>