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

313 lines
9.2 KiB

4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
3 months ago
4 months ago
3 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
3 months ago
4 months ago
3 months ago
4 months ago
3 months ago
4 months ago
4 months ago
3 months ago
4 months ago
4 months ago
4 months ago
4 months ago
4 months ago
3 months ago
4 months ago
  1. <template>
  2. <view>
  3. <view class="se-pos-fixed se-pos-lt se-w-p-100">
  4. <view class="se-p-20" style="background: linear-gradient(168deg,#669a32 0%, #669a32 100%);">
  5. <u-search @click="onSearch()" @search="onSearch()" :showAction="false" bgColor="#fff" placeholder="搜索" v-model="goodsName"></u-search>
  6. </view>
  7. <view class="se-flex se-bgc-white se-fs-26 se-h-80 se-b-b">
  8. <view class="se-flex-1 se-flex se-flex-h-c" @click="handleCategoryTwoChange()">
  9. <text class="se-mr-10" v-if="categorytwoName">{{categorytwoName}}</text>
  10. <text class="se-mr-10" v-else>分类</text>
  11. <u-icon name="arrow-down-fill" color="#666666"></u-icon>
  12. </view>
  13. <view class="se-flex-1 se-b-l se-b-r se-flex se-flex-h-c" @click="showDate=true">
  14. <text class="se-mr-10" v-if="goodsTime">{{goodsTime}}</text>
  15. <text class="se-mr-10" v-else>时间</text>
  16. <u-icon name="arrow-down-fill" color="#666666"></u-icon>
  17. </view>
  18. <view class="se-flex-1 se-flex se-flex-h-c" @click="handleMileageChange()">
  19. <text class="se-mr-10" v-if="mileageName">{{mileageName}}</text>
  20. <text class="se-mr-10" v-else>公里数</text>
  21. <u-icon name="arrow-down-fill" color="#666666"></u-icon>
  22. </view>
  23. </view>
  24. </view>
  25. <view class="se-grid-2 se-pt-200">
  26. <view class="items-box se-br-5 se-px-10" v-for="(items,indexs) in list" :key="indexs" @click="onDetail(items)">
  27. <image class="se-w-p-100 se-h-200 se-bgc-f5 se-br-5 se-py-5" :src="items.images[0]" mode=""></image>
  28. <view class="se-c-black se-fs-24 se-fw-6 se-mt-10">
  29. {{ items.goodsName }}
  30. </view>
  31. <view class="se-flex se-flex-ff-rw se-mt-10" v-if="items.categoryoneName!='环卫设备及配件'">
  32. <view class="se-tag">
  33. {{items.brand}}
  34. </view>
  35. <view class="se-tag">
  36. {{items.goodsTime}}
  37. </view>
  38. <view class="se-tag">
  39. {{items.mileage}}公里
  40. </view>
  41. </view>
  42. <view class="se-flex se-flex-h-sb se-w-p-100 se-pt-20">
  43. <view class="se-fs-24 se-display-ib">
  44. <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>
  45. </view>
  46. <view class="se-display-ib se-bgc-orange se-px-15 se-br-40 se-flex-h-c se-h-40 se-lh-40 se-ta-c se-fs-22 se-c-white se-b">
  47. <text>查看详情</text>
  48. </view>
  49. </view>
  50. </view>
  51. </view>
  52. <u-empty v-if="list && list.length==0" mode="list"></u-empty>
  53. <u-action-sheet :actions="categoryTwoList" @select="selectCategoryTwoClick" title="分类" :show="categoryTwoShow" @close="categoryTwoClose"></u-action-sheet>
  54. <u-action-sheet :actions="mileageList" @select="selectMileageClick" title="公里数" :show="mileageShow" @close="MileageClose"></u-action-sheet>
  55. <!-- <u-datetime-picker
  56. :show="showDate"
  57. v-model="date"
  58. mode="date"
  59. @confirm="onConfirm"
  60. @cancel="onCancel"
  61. ></u-datetime-picker> -->
  62. <u-picker :show="showDate" :columns="columns" @confirm="onConfirm"
  63. @cancel="onCancel"></u-picker>
  64. </view>
  65. </template>
  66. <script>
  67. import { queryGoodsList,queryCategoryTwoList,queryCategoryList,queryMileageList } from "@/common/api.js"
  68. export default{
  69. data(){
  70. return{
  71. columns:[["全部",'2025', '2024', '2023', '2022', '2020', '2019', '2018', '2017', '2016', '2015', '2014', '2013', '2012', '2011', '2010', '2009', '2008', '2007', '2006', '2005', '2004', '2003', '2002', '2001', '2000']],
  72. mileageShow:false,
  73. showDate:false,
  74. goodsName:null,
  75. id:null,
  76. goodsTime:null,
  77. date:Number(new Date()),
  78. categoryTwoShow:false,
  79. categorytwoId:null,
  80. categorytwoName:null,
  81. categoryTwoList:[],
  82. mileageId:null,
  83. mileageName:null,
  84. mileageList:[],
  85. pageNo:1,
  86. list:[],
  87. }
  88. },
  89. onLoad(options) {
  90. if(options.id){
  91. this.id = options.id
  92. }
  93. this.onPageList()
  94. this.onQueryCategoryTwoList()
  95. this.onQueryMileageList()
  96. },
  97. onPullDownRefresh() {
  98. let that = this
  99. that.pageNo = 1
  100. that.list = []
  101. that.onPageList()
  102. },
  103. onReachBottom() {
  104. let that = this
  105. that.pageNo = that.pageNo + 1
  106. that.onPageList()
  107. },
  108. filters:{
  109. getPersonAuthentication(price){
  110. let companyAuthenticationStatus = uni.getStorageSync("companyAuthenticationStatus")
  111. if(companyAuthenticationStatus==1){
  112. return price
  113. }
  114. let personAuthenticationStatus =uni.getStorageSync("personAuthenticationStatus")
  115. if (personAuthenticationStatus != 1){
  116. return '***';
  117. }
  118. return price
  119. }
  120. },
  121. methods:{
  122. onCancel(){
  123. this.goodsTime=""
  124. this.showDate = false
  125. this.onPageList()
  126. },
  127. onConfirm(e){
  128. this.goodsTime = e.value[0];
  129. this.showDate = false
  130. // console.info('e',e)
  131. // const date = new Date(e.value);
  132. // const year = date.getFullYear();
  133. // const month = String(date.getMonth() + 1).padStart(2, '0');
  134. // const day = String(date.getDate()).padStart(2, '0');
  135. // this.goodsTime = `${year}-${month}-${day}`;
  136. // this.showDate = false
  137. this.pageNo = 1
  138. this.onPageList()
  139. },
  140. handleCategoryTwoChange(){
  141. console.info('handleCategoryTwoChange')
  142. this.categoryTwoShow = true
  143. },
  144. categoryTwoClose(){
  145. this.categoryTwoShow = false
  146. this.pageNo = 1
  147. },
  148. handleMileageChange(){
  149. this.mileageShow = true
  150. },
  151. MileageClose(){
  152. this.mileageShow = false
  153. this.pageNo = 1
  154. },
  155. selectMileageClick(event){
  156. console.info("selectMileageClick",event)
  157. this.mileageId = event.id
  158. this.mileageName = event.mileage
  159. this.mileageShow = false
  160. this.pageNo = 1
  161. this.onPageList()
  162. },
  163. selectCategoryTwoClick(event){
  164. console.info("selectCategoryTwoClick",event)
  165. this.categorytwoId = event.id
  166. this.categorytwoName = event.name
  167. this.categoryTwoShow = false
  168. this.pageNo = 1
  169. this.onPageList()
  170. },
  171. onQueryCategoryTwoList(){
  172. let that = this
  173. let params = {
  174. // categoryoneId:that.id,
  175. categoryOneId:that.id,
  176. }
  177. queryCategoryList(params).then(response=>{
  178. // queryCategoryTwoList(params).then(response=>{
  179. console.info("queryCategoryTwoList",response)
  180. if(response.result.length>0){
  181. let arr = [{id:null,name:"全部"}]
  182. that.categoryTwoList = arr.concat(response.result[0].carrentCategorytwoList)
  183. }
  184. }).catch(error=>{
  185. })
  186. },
  187. onQueryMileageList(){
  188. let that = this
  189. let params = {}
  190. queryMileageList(params).then(response=>{
  191. console.info("queryMileageList",response)
  192. response.result.forEach(items=>{
  193. items.name = items.mileage
  194. })
  195. let arr = [{id:null,name:"全部"}]
  196. that.mileageList = arr.concat(response.result)
  197. }).catch(error=>{
  198. })
  199. },
  200. onSearch(){
  201. this.pageNo = 1
  202. this.onPageList()
  203. },
  204. onPageList(){
  205. let that = this
  206. let params={
  207. status:1,
  208. cartypeId:that.id,
  209. categorytwoId:that.categorytwoId,
  210. mileage:that.mileageName,
  211. goodsTime:that.goodsTime!='全部'?that.goodsTime:'',
  212. goodsName:that.goodsName,
  213. pageNo:that.pageNo,
  214. pageSize:that.pageSize,
  215. }
  216. queryGoodsList(params).then((response) => {
  217. console.info('queryGoodsList',response)
  218. response.result.records.forEach((items,indexs)=>{
  219. if(items.image){
  220. items.images = items.image.split(',')
  221. }else{
  222. items.images = []
  223. }
  224. if(items.imageBack){
  225. items.imageBacks = items.imageBack.split(',')
  226. }else{
  227. items.imageBacks = []
  228. }
  229. if(items.imageCab){
  230. items.imageCabs = items.imageCab.split(',')
  231. }else{
  232. items.imageCabs = []
  233. }
  234. if(items.imageFront){
  235. items.imageFronts = items.imageFront.split(',')
  236. }else{
  237. items.imageFronts = []
  238. }
  239. if(items.imageLeft){
  240. items.imageLefts = items.imageLeft.split(',')
  241. }else{
  242. items.imageLefts = []
  243. }
  244. if(items.imageRight){
  245. items.imageRights = items.imageRight.split(',')
  246. }else{
  247. items.imageRights = []
  248. }
  249. })
  250. if(that.pageNo==1){
  251. that.list = response.result.records
  252. }else{
  253. that.list = that.list.concat(response.result.records)
  254. }
  255. }).catch((error) =>{
  256. })
  257. },
  258. onDetail(event){
  259. let companyAuthenticationStatus = uni.getStorageSync("companyAuthenticationStatus")
  260. if(companyAuthenticationStatus==1){
  261. uni.navigateTo({
  262. url:"/pages_subpack/detail/index?goodsId="+event.id
  263. })
  264. return;
  265. }
  266. let personAuthenticationStatus =uni.getStorageSync("personAuthenticationStatus")
  267. if (personAuthenticationStatus != 1){
  268. return uni.showModal({
  269. title:"未认证",
  270. showCancel:false,
  271. content:"立即前往认证",
  272. success() {
  273. uni.navigateTo({
  274. url:"/pages/identity/index?userStatus=1"
  275. })
  276. }
  277. })
  278. }
  279. uni.navigateTo({
  280. url:"/pages_subpack/detail/index?goodsId="+event.id
  281. })
  282. },
  283. }
  284. }
  285. </script>
  286. <style>
  287. .items-box{
  288. background: #ffffff;
  289. border-radius: 8rpx;
  290. box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(0,0,0,0.05);
  291. padding: 20rpx;
  292. }
  293. .se-tag{
  294. margin-right: 10rpx;
  295. margin-top: 5px;
  296. padding: 5rpx 10rpx;
  297. background: #fff2df;
  298. border-radius: 4rpx;
  299. border: 2rpx solid rgba(0,0,0,0.00);
  300. font-size: 16rpx;
  301. font-family: PingFang SC, PingFang SC-Bold;
  302. font-weight: 700;
  303. text-align: center;
  304. color: #fab143;
  305. }
  306. </style>