环卫车小程序前端代码
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.

191 lines
5.1 KiB

11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
11 months ago
  1. <template>
  2. <view class="se-h-vh-100 se-w-vw-100 se-flex">
  3. <view class="se-w-vw-25 se-bgc-f5">
  4. <view class="se-h-80 se-lh-80 se-tos-1 se-ta-c se-fs-24 se-c-black " @click="onItems(indexs,items)" :class="indexs==current?'se-bgc-white se-c-green':''" v-for="(items,indexs) in navList" :key="indexs">
  5. <text>{{items.name}}</text>
  6. </view>
  7. </view>
  8. <view class="se-w-vw-75 se-scroll-y">
  9. <view class="se-grid-2 se-pt-10">
  10. <view class="items-box se-br-5 se-px-10" v-for="(items,indexs) in list" :key="indexs" @click="onDetail(items)">
  11. <image class="se-w-p-100 se-h-200 se-bgc-f5 se-br-5 se-py-5" :src="items.images[0]" mode=""></image>
  12. <view class="se-c-black se-fs-24 se-fw-6 se-mt-10">
  13. {{ items.goodsName }}
  14. </view>
  15. <!-- <view class="se-flex se-flex-ff-rw se-mt-10">
  16. <view class="se-tag">
  17. {{items.brand}}
  18. </view>
  19. <view class="se-tag">
  20. {{items.goodsTime}}
  21. </view>
  22. <view class="se-tag">
  23. {{items.mileage}}公里
  24. </view>
  25. </view> -->
  26. <view class="se-flex se-flex-h-sb se-w-p-100 se-pt-20">
  27. <view class="se-fs-24 se-display-ib">
  28. <text class="se-c-orange se-fs-26 se-fw-6"><text class="se-fs-24"></text>{{items.price | getPersonAuthentication}}<text class="se-fs-24"></text><text class="se-fs-24" v-if="items.cartypeId=='1875536807086256130'">/</text></text>
  29. </view>
  30. </view>
  31. </view>
  32. </view>
  33. <u-empty v-if="list && list.length==0" mode="list"></u-empty>
  34. </view>
  35. </view>
  36. </template>
  37. <script>
  38. import { queryCategoryList,queryGoodsList } from "@/common/api.js"
  39. export default {
  40. data(){
  41. return{
  42. id:null,
  43. categorytwoId:"",
  44. current:0,
  45. navList:[],
  46. list:[],
  47. pageNo:1,
  48. pageSize:20
  49. }
  50. },
  51. onLoad(options) {
  52. this.id = options.id
  53. this.onQueryCategoryTwoList()
  54. },
  55. filters:{
  56. getPersonAuthentication(price){
  57. let companyAuthenticationStatus = uni.getStorageSync("companyAuthenticationStatus")
  58. if(companyAuthenticationStatus==1){
  59. return price
  60. }
  61. let personAuthenticationStatus =uni.getStorageSync("personAuthenticationStatus")
  62. if (personAuthenticationStatus != 1){
  63. return '***';
  64. }
  65. return price
  66. }
  67. },
  68. methods:{
  69. onItems(indexs,items){
  70. this.current=indexs
  71. this.categorytwoId = items.id
  72. this.pageNo=1
  73. this.onPageList()
  74. },
  75. onQueryCategoryTwoList(){
  76. let that = this
  77. let params = {
  78. categoryOneId:that.id
  79. }
  80. queryCategoryList(params).then(response=>{
  81. that.navList = response.result[0].carrentCategorytwoList
  82. that.categorytwoId = response.result[0].carrentCategorytwoList[0].id
  83. that.onPageList()
  84. }).catch(error=>{
  85. })
  86. },
  87. onPageList(){
  88. let that = this
  89. let params={
  90. status:1,
  91. cartypeId:that.id,
  92. categorytwoId:that.categorytwoId,
  93. pageNo:that.pageNo,
  94. pageSize:that.pageSize,
  95. }
  96. queryGoodsList(params).then((response) => {
  97. console.info('queryGoodsList',response)
  98. response.result.records.forEach((items,indexs)=>{
  99. if(items.image){
  100. items.images = items.image.split(',')
  101. }else{
  102. items.images = []
  103. }
  104. if(items.imageBack){
  105. items.imageBacks = items.imageBack.split(',')
  106. }else{
  107. items.imageBacks = []
  108. }
  109. if(items.imageCab){
  110. items.imageCabs = items.imageCab.split(',')
  111. }else{
  112. items.imageCabs = []
  113. }
  114. if(items.imageFront){
  115. items.imageFronts = items.imageFront.split(',')
  116. }else{
  117. items.imageFronts = []
  118. }
  119. if(items.imageLeft){
  120. items.imageLefts = items.imageLeft.split(',')
  121. }else{
  122. items.imageLefts = []
  123. }
  124. if(items.imageRight){
  125. items.imageRights = items.imageRight.split(',')
  126. }else{
  127. items.imageRights = []
  128. }
  129. })
  130. if(that.pageNo==1){
  131. that.list = response.result.records
  132. }else{
  133. that.list = that.list.concat(response.result.records)
  134. }
  135. }).catch((error) =>{
  136. })
  137. },
  138. onDetail(event){
  139. let companyAuthenticationStatus = uni.getStorageSync("companyAuthenticationStatus")
  140. if(companyAuthenticationStatus==1){
  141. uni.navigateTo({
  142. url:"/pages_subpack/detail/index?goodsId="+event.id
  143. })
  144. return;
  145. }
  146. let personAuthenticationStatus =uni.getStorageSync("personAuthenticationStatus")
  147. if (personAuthenticationStatus != 1){
  148. return uni.showModal({
  149. title:"未认证",
  150. showCancel:false,
  151. content:"立即前往认证",
  152. success() {
  153. uni.navigateTo({
  154. url:"/pages/identity/index?userStatus=1"
  155. })
  156. }
  157. })
  158. }
  159. uni.navigateTo({
  160. url:"/pages_subpack/detail/index?goodsId="+event.id
  161. })
  162. }
  163. }
  164. }
  165. </script>
  166. <style>
  167. .items-box{
  168. background: #ffffff;
  169. border-radius: 8rpx;
  170. box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(0,0,0,0.05);
  171. padding: 20rpx;
  172. }
  173. .se-tag{
  174. margin-right: 10rpx;
  175. margin-top: 5px;
  176. padding: 5rpx 10rpx;
  177. background: #fff2df;
  178. border-radius: 4rpx;
  179. border: 2rpx solid rgba(0,0,0,0.00);
  180. font-size: 16rpx;
  181. font-family: PingFang SC, PingFang SC-Bold;
  182. font-weight: 700;
  183. text-align: center;
  184. color: #fab143;
  185. }
  186. </style>