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

365 lines
11 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
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 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
4 months ago
5 months ago
5 months ago
5 months ago
5 months ago
4 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
4 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 se-pos-lt" style="z-index: -1;width: 750rpx;height: 388rpx;
  4. background: linear-gradient(168deg,#669a32 0%, #669a32 72%);
  5. border-radius: 0rpx 0rpx 80rpx 80rpx;">
  6. </view>
  7. <view class="se-flex se-flex-h-sb se-px-20 se-pb-10 se-pt-10 se-zi-s" style="background-color: transparent;">
  8. <view class="se-c-white se-fs-28">
  9. <view class="se-c-white se-py-5 se-px-10 se-fw-6 se-br-12 se-fs-30 se-display-ib">
  10. 环保
  11. </view>
  12. <text class="se-ml-10 se-fw-6 se-fs-26">寻找你想要的</text>
  13. </view>
  14. </view>
  15. <view class="se-px-40 se-py-20">
  16. <view class=" se-br-50 se-c-black se-px-20 se-py-5 se-flex se-flex-h-sb se-fs-26">
  17. <view class="se-pl-10 se-pr-20 se-flex se-flex-h se-h-40 se-lh-40 " @click="getLocation()">
  18. <text class="se-pr-20 se-c-white nobreak">{{city?city:'未知'}}</text>
  19. <u-icon name="arrow-down-fill" color="#ffffff"></u-icon>
  20. </view>
  21. <view class="se-ml-20 se-w-p-100">
  22. <u-search :disabled="true" @click="onSearch()" :showAction="false" bgColor="#ffffff" placeholder="搜索" v-model="keyword"></u-search>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="se-pb-20 se-pt-40 se-zi-s">
  27. <view class="se-px-20 se-br-20">
  28. <!-- <image src="" mode="widthFix"></image> -->
  29. <u-swiper :imgMode="widthFix" height="320rpx" :indicator="true" indicatorMode="dot" :loading="false" :circular="true" :interval="4000" :autoplay="true" style="background-color: #f5f5f5;height: 320rpx;" keyName="image" :list="swiperList" @click="swiperClick"></u-swiper>
  30. </view>
  31. <!-- <view class="se-pt-10 se-bgc-white se-px-0 se-py-10 se-ta-l se-c-orange se-flex se-flex-ai-c se-fs-26">
  32. <image class="se-a-80" src="@/static/image/aed60x.png" mode=""></image>
  33. <text class="se-ml-10">今日有6个工作息新发布....</text>
  34. </view> -->
  35. </view>
  36. <view class="se-my-20 se-pt-20 se-bgc-white se-grid">
  37. <navigator :url="item.path" v-for="(item, index) in nav" :key="index" class="se-flex-v-c se-pt-10 se-mb-10">
  38. <image class="se-a-100 se-br-20" :src="item.image" mode=""></image>
  39. <text class="se-w-150 se-h-60 se-lh-30 se-c-black se-fs-22 se-ta-c se-mt-10 se-toe-2">{{item.title}}</text>
  40. </navigator>
  41. </view>
  42. <view class="se-px-30 se-py-30 se-bgc-white se-c-black">
  43. <!-- 精品二手车 -->
  44. 精品车列表
  45. </view>
  46. <view class="se-grid-2">
  47. <view class="items-box se-br-5 se-px-10" v-for="(items,indexs) in list" :key="indexs" @click="onDetail(items)">
  48. <image class="se-w-p-100 se-h-200 se-bgc-f5 se-br-5 se-py-5" :src="items.images[0]" mode=""></image>
  49. <view class="se-c-black se-fs-24 se-fw-6 se-mt-10">
  50. {{ items.goodsName }}
  51. </view>
  52. <view class="se-flex se-flex-ff-rw se-mt-10" v-if="items.categoryoneName!='环卫设备及配件'">
  53. <view class="se-tag">
  54. {{items.brand}}
  55. </view>
  56. <view class="se-tag">
  57. {{items.goodsTime}}
  58. </view>
  59. <view class="se-tag">
  60. {{items.mileage}}公里
  61. </view>
  62. </view>
  63. <view class="se-flex se-flex-h-sb se-w-p-100 se-pt-20">
  64. <view class="se-fs-24 se-display-ib">
  65. <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>
  66. </view>
  67. <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">
  68. <text>查看详情</text>
  69. </view>
  70. </view>
  71. </view>
  72. </view>
  73. </view>
  74. </template>
  75. <script>
  76. import { getInfo,queryGoodsList,queryBannerList,queryModuleList } from "@/common/api.js"
  77. import QQMapWX from "@/util/qqmap-wx-jssdk.min.js"
  78. export default{
  79. components:{
  80. },
  81. data(){
  82. return {
  83. city:"",
  84. swiperList: [],
  85. nav:[],
  86. pageNo:1,
  87. pageSize:10,
  88. list:[]
  89. }
  90. },
  91. onLoad(options) {
  92. wx.showShareMenu({
  93. withShareTicket: true,
  94. menus: ['shareAppMessage', 'shareTimeline']
  95. });
  96. if(options.shareId){
  97. uni.setStorageSync('shareId',options.shareId)
  98. }
  99. this.onPageList()
  100. this.getLocation()
  101. this.onQueryBannerList()
  102. this.onQueryModuleList()
  103. },
  104. onPullDownRefresh() {
  105. let that = this
  106. that.pageNo = 1
  107. that.list = []
  108. that.onPageList()
  109. this.getLocation()
  110. this.onQueryBannerList()
  111. this.onQueryModuleList()
  112. },
  113. onReachBottom() {
  114. let that = this
  115. that.pageNo = that.pageNo + 1
  116. that.onPageList()
  117. },
  118. onShareAppMessage() {
  119. let share = {
  120. path:"/pages/home/index?shareId="+uni.getStorageSync('userInfo').id,
  121. success:(res) => {
  122. console.info(res)
  123. },
  124. fail:(err)=>{
  125. console.info(err)
  126. }
  127. }
  128. console.info(share)
  129. return share
  130. },
  131. filters:{
  132. getPersonAuthentication(price){
  133. let companyAuthenticationStatus = uni.getStorageSync("companyAuthenticationStatus")
  134. if(companyAuthenticationStatus==1){
  135. return price
  136. }
  137. let personAuthenticationStatus =uni.getStorageSync("personAuthenticationStatus")
  138. if (personAuthenticationStatus != 1){
  139. return '***';
  140. }
  141. return price
  142. }
  143. },
  144. methods:{
  145. onQueryModuleList(){
  146. const that = this;
  147. let params={}
  148. queryModuleList(params).then(response=>{
  149. console.info("queryBannerList",response)
  150. that.nav = response.result.records
  151. // that.swiperList = response.result.records
  152. }).catch(error=>{
  153. })
  154. },
  155. onSearch(){
  156. uni.navigateTo({
  157. url:"/pages_subpack/category/index"
  158. })
  159. },
  160. handleAreaChange(){
  161. console.info("获取地址")
  162. },
  163. swiperClick(event){
  164. console.info(event)
  165. },
  166. onDetail(event){
  167. let companyAuthenticationStatus = uni.getStorageSync("companyAuthenticationStatus")
  168. if(companyAuthenticationStatus==1){
  169. uni.navigateTo({
  170. url:"/pages_subpack/detail/index?goodsId="+event.id
  171. })
  172. return;
  173. }
  174. let personAuthenticationStatus =uni.getStorageSync("personAuthenticationStatus")
  175. if (personAuthenticationStatus != 1){
  176. return uni.showModal({
  177. title:"未认证",
  178. showCancel:false,
  179. content:"立即前往认证",
  180. success() {
  181. uni.navigateTo({
  182. url:"/pages/identity/index?userStatus=1"
  183. })
  184. }
  185. })
  186. }
  187. uni.navigateTo({
  188. url:"/pages_subpack/detail/index?goodsId="+event.id
  189. })
  190. },
  191. getLocation(){
  192. const that = this;
  193. wx.getLocation({
  194. type: 'wgs84',
  195. success: function (res) {
  196. console.log('当前位置的经度:' + res.longitude);
  197. console.log('当前位置的纬度:' + res.latitude);
  198. const qqmapsdk = new QQMapWX({
  199. key: 'TT7BZ-Z3LW4-KOAUB-KWHOA-SBJJ6-Y5B6R' // 必填
  200. });
  201. qqmapsdk.reverseGeocoder({
  202. location: {
  203. latitude: res.latitude,
  204. longitude: res.longitude
  205. },
  206. success: function(response) {
  207. that.city = response.result.ad_info.city
  208. console.log('逆地理编码结果:', response);
  209. },
  210. fail: function(error) {
  211. console.error('逆地理编码失败:', error);
  212. }
  213. });
  214. },
  215. fail(err) {
  216. console.error('获取位置失败:', err);
  217. if (err.errMsg.includes('auth deny') || err.errMsg.includes('auth denied')) {
  218. // 引导用户授权
  219. uni.showModal({
  220. title: '授权提示',
  221. content: '需要获取位置信息,请前往设置授权',
  222. success: (res) => {
  223. if (res.confirm) {
  224. uni.openSetting({
  225. success: (settingRes) => {
  226. if (settingRes.authSetting['scope.userLocation']) {
  227. console.log('用户已重新授权');
  228. // 重新调用获取位置信息
  229. uni.getLocation({
  230. type: 'wgs84',
  231. success: (res) => {
  232. const qqmapsdk = new QQMapWX({
  233. key: 'TT7BZ-Z3LW4-KOAUB-KWHOA-SBJJ6-Y5B6R' // 必填
  234. });
  235. qqmapsdk.reverseGeocoder({
  236. location: {
  237. latitude: res.latitude,
  238. longitude: res.longitude
  239. },
  240. success: function(response) {
  241. that.city = response.result.ad_info.city
  242. console.log('逆地理编码结果:', response);
  243. },
  244. fail: function(error) {
  245. console.error('逆地理编码失败:', error);
  246. }
  247. });
  248. },
  249. fail: (err) => {
  250. console.error('重新获取位置失败:', err);
  251. },
  252. });
  253. } else {
  254. console.error('用户未授权位置信息');
  255. }
  256. },
  257. });
  258. }
  259. },
  260. });
  261. }
  262. }
  263. })
  264. },
  265. onQueryBannerList(){
  266. let that = this
  267. let params={}
  268. queryBannerList(params).then(response=>{
  269. console.info("queryBannerList",response)
  270. that.swiperList = response.result.records
  271. }).catch(error=>{
  272. })
  273. },
  274. onPageList(){
  275. let that = this
  276. let params={
  277. status:1,
  278. pageNo:that.pageNo,
  279. pageSize:that.pageSize,
  280. }
  281. queryGoodsList(params).then((response) => {
  282. console.info('queryGoodsList',response)
  283. response.result.records.forEach((items,indexs)=>{
  284. if(items.image){
  285. items.images = items.image.split(',')
  286. }else{
  287. items.images = []
  288. }
  289. if(items.imageBack){
  290. items.imageBacks = items.imageBack.split(',')
  291. }else{
  292. items.imageBacks = []
  293. }
  294. if(items.imageCab){
  295. items.imageCabs = items.imageCab.split(',')
  296. }else{
  297. items.imageCabs = []
  298. }
  299. if(items.imageFront){
  300. items.imageFronts = items.imageFront.split(',')
  301. }else{
  302. items.imageFronts = []
  303. }
  304. if(items.imageLeft){
  305. items.imageLefts = items.imageLeft.split(',')
  306. }else{
  307. items.imageLefts = []
  308. }
  309. if(items.imageRight){
  310. items.imageRights = items.imageRight.split(',')
  311. }else{
  312. items.imageRights = []
  313. }
  314. })
  315. that.list = that.list.concat(response.result.records)
  316. }).catch((error) =>{
  317. })
  318. },
  319. }
  320. }
  321. </script>
  322. <style>
  323. .nobreak {
  324. white-space: nowrap;
  325. }
  326. page{
  327. background-color: #f5f5f5;
  328. }
  329. .enterprise{
  330. background: #ff7a31;
  331. border: 4rpx solid rgba(255,255,255,0.50);
  332. border-radius: 14rpx;
  333. }
  334. .master{
  335. background: #f0b744;
  336. border: 4rpx solid rgba(255,255,255,0.50);
  337. border-radius: 14rpx;
  338. }
  339. .items-box{
  340. background: #ffffff;
  341. border-radius: 8rpx;
  342. box-shadow: 0rpx 4rpx 16rpx 0rpx rgba(0,0,0,0.05);
  343. padding: 20rpx;
  344. }
  345. .se-tag{
  346. margin-right: 10rpx;
  347. margin-top: 5px;
  348. padding: 5rpx 10rpx;
  349. background: #fff2df;
  350. border-radius: 4rpx;
  351. border: 2rpx solid rgba(0,0,0,0.00);
  352. font-size: 16rpx;
  353. font-family: PingFang SC, PingFang SC-Bold;
  354. font-weight: 700;
  355. text-align: center;
  356. color: #fab143;
  357. }
  358. </style>