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

235 lines
6.6 KiB

5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 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.image" 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-mt-10">
  32. <view class="se-tag">
  33. {{items.cartypeId_dictText}}
  34. </view>
  35. <view class="se-tag">
  36. {{items.categorytwoId_dictText}}
  37. </view>
  38. </view>
  39. <view class="se-flex se-flex-h-sb se-w-p-100 se-pt-20">
  40. <view class="se-fs-24 se-display-ib">
  41. <text class="se-c-orange se-fs-30 se-fw-6"><text class="se-fs-24"></text>{{items.price}}<text class="se-fs-24"></text></text>
  42. </view>
  43. <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">
  44. <text>查看详情</text>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <u-empty v-if="list && list.length==0" mode="list"></u-empty>
  50. <u-action-sheet :actions="categoryTwoList" @select="selectCategoryTwoClick" title="分类" :show="categoryTwoShow" @close="categoryTwoClose"></u-action-sheet>
  51. <u-action-sheet :actions="mileageList" @select="selectMileageClick" title="公里数" :show="mileageShow" @close="MileageClose"></u-action-sheet>
  52. <u-datetime-picker
  53. :show="showDate"
  54. v-model="date"
  55. mode="date"
  56. @confirm="onConfirm"
  57. @cancel="onCancel"
  58. ></u-datetime-picker>
  59. </view>
  60. </template>
  61. <script>
  62. import { queryGoodsList,queryCategoryTwoList,queryMileageList } from "@/common/api.js"
  63. export default{
  64. data(){
  65. return{
  66. mileageShow:false,
  67. showDate:false,
  68. goodsName:null,
  69. id:null,
  70. goodsTime:null,
  71. date:Number(new Date()),
  72. categoryTwoShow:false,
  73. categorytwoId:null,
  74. categorytwoName:null,
  75. categoryTwoList:[],
  76. mileageId:null,
  77. mileageName:null,
  78. mileageList:[],
  79. pageNo:1,
  80. list:[],
  81. }
  82. },
  83. onLoad(options) {
  84. if(options.id){
  85. this.id = options.id
  86. }
  87. this.onPageList()
  88. this.onQueryCategoryTwoList()
  89. this.onQueryMileageList()
  90. },
  91. onPullDownRefresh() {
  92. let that = this
  93. that.pageNo = 1
  94. that.list = []
  95. that.onPageList()
  96. },
  97. onReachBottom() {
  98. let that = this
  99. that.pageNo = that.pageNo + 1
  100. that.onPageList()
  101. },
  102. methods:{
  103. onCancel(){
  104. this.goodsTime=""
  105. this.showDate = false
  106. this.onPageList()
  107. },
  108. onConfirm(e){
  109. console.info('e',e)
  110. const date = new Date(e.value);
  111. const year = date.getFullYear();
  112. const month = String(date.getMonth() + 1).padStart(2, '0');
  113. const day = String(date.getDate()).padStart(2, '0');
  114. this.goodsTime = `${year}-${month}-${day}`;
  115. this.showDate = false
  116. this.pageNo = 1
  117. this.onPageList()
  118. },
  119. handleCategoryTwoChange(){
  120. console.info('handleCategoryTwoChange')
  121. this.categoryTwoShow = true
  122. },
  123. categoryTwoClose(){
  124. this.categoryTwoShow = false
  125. this.pageNo = 1
  126. },
  127. handleMileageChange(){
  128. this.mileageShow = true
  129. },
  130. MileageClose(){
  131. this.mileageShow = false
  132. this.pageNo = 1
  133. },
  134. selectMileageClick(event){
  135. console.info("selectMileageClick",event)
  136. this.mileageId = event.id
  137. this.mileageName = event.mileage
  138. this.mileageShow = false
  139. this.pageNo = 1
  140. this.onPageList()
  141. },
  142. selectCategoryTwoClick(event){
  143. console.info("selectCategoryTwoClick",event)
  144. this.categorytwoId = event.id
  145. this.categorytwoName = event.name
  146. this.categoryTwoShow = false
  147. this.pageNo = 1
  148. this.onPageList()
  149. },
  150. onQueryCategoryTwoList(){
  151. let that = this
  152. let params = {
  153. categoryoneId:"1867039853005877250"
  154. }
  155. queryCategoryTwoList(params).then(response=>{
  156. console.info("queryCategoryTwoList",response)
  157. that.categoryTwoList = response.result.records
  158. }).catch(error=>{
  159. })
  160. },
  161. onQueryMileageList(){
  162. let that = this
  163. let params = {}
  164. queryMileageList(params).then(response=>{
  165. console.info("queryMileageList",response)
  166. response.result.forEach(items=>{
  167. items.name = items.mileage
  168. })
  169. that.mileageList = response.result
  170. }).catch(error=>{
  171. })
  172. },
  173. onSearch(){
  174. this.pageNo = 1
  175. this.onPageList()
  176. },
  177. onPageList(){
  178. let that = this
  179. let params={
  180. cartypeId:that.id,
  181. categorytwoId:that.categorytwoId,
  182. mileage:that.mileageName,
  183. goodsTime:that.goodsTime,
  184. goodsName:that.goodsName,
  185. pageNo:that.pageNo,
  186. pageSize:that.pageSize
  187. }
  188. queryGoodsList(params).then((response) => {
  189. console.info('queryGoodsList',response)
  190. if(that.pageNo==1){
  191. that.list = response.result.records
  192. }else{
  193. that.list = that.list.concat(response.result.records)
  194. }
  195. }).catch((error) =>{
  196. })
  197. },
  198. onDetail(event){
  199. uni.navigateTo({
  200. url:"/pages_subpack/detail/index?goodsId="+event.id
  201. })
  202. },
  203. }
  204. }
  205. </script>
  206. <style>
  207. .items-box{
  208. background: #ffffff;
  209. border-radius: 8rpx;
  210. box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(0,0,0,0.05);
  211. padding: 20rpx;
  212. }
  213. .se-tag{
  214. padding: 5rpx 10rpx;
  215. background: #fff2df;
  216. border-radius: 4rpx;
  217. border: 2rpx solid rgba(0,0,0,0.00);
  218. font-size: 16rpx;
  219. font-family: PingFang SC, PingFang SC-Bold;
  220. font-weight: 700;
  221. text-align: center;
  222. color: #fab143;
  223. margin-left: 10rpx;
  224. }
  225. .se-tag:first-child{
  226. margin-left: 0rpx;
  227. }
  228. </style>