index.vue 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364
  1. <template>
  2. <view class="content">
  3. <view class="content-top">
  4. <view class="top-banner">
  5. <u-swiper :list="bannerList" class="banner"></u-swiper>
  6. </view>
  7. </view>
  8. <view class="content-bottom">
  9. <!-- 预约 -->
  10. <u-button :custom-style="yuYueBtn" :hair-line="false" @click="gotoYueYu">一键预约</u-button>
  11. <!-- 接单信息 -->
  12. <view class="bottom-new-notice">
  13. <view class="notice-content">
  14. <view class="notice-content-item"><span class="t-icon t-icon-home_icon_bells"></span><span class="item-title">最新通知</span></view>
  15. <view class="notice-content-item">骑手<span>{{orderStatusText ? orderStatusText :''}},</span>请耐心等待</view>
  16. <view class="notice-content-item">{{orderTime ? orderTime :''}}</view>
  17. </view>
  18. <view class="notice-static">
  19. <span class="notice-static-text">{{orderStatusText ? orderStatusText :''}}</span>
  20. </view>
  21. </view>
  22. <!-- 回收指引 -->
  23. <view class="bottom-zhiyin" @click="toZY">
  24. <u-image src="/static/houme_bg_guide.png" mode="" height="160"></u-image>
  25. </view>
  26. <!-- 收回统计 -->
  27. <view class="statistics-title">今日上门回收价格</view>
  28. <view class="bottom-statistics" v-if="hasLogin">
  29. <view class="statistics-rubbishType">
  30. <view class="statistics-box">
  31. <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_paper" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishPaperName ? rubbishPaperName :''}}</view>
  32. <view v-for="item in rubbishPaperList" class="rubbishType-item">
  33. <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
  34. </view>
  35. </view>
  36. <view class="statistics-box">
  37. <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_clothing" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishYWName ? rubbishYWName :''}}</view>
  38. <view v-for="item in rubbishYWList" class="rubbishType-item">
  39. <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
  40. </view>
  41. </view>
  42. </view>
  43. <view class="statistics-rubbishType">
  44. <view class="statistics-box">
  45. <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_plastic" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishSLName ? rubbishSLName :''}}</view>
  46. <view v-for="item in rubbishSLList" class="rubbishType-item">
  47. <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
  48. </view>
  49. </view>
  50. <view class="statistics-box">
  51. <view class="rubbishType-type"><span class="t-icon t-icon-home_icon_metal" style="display: inline-block;margin: 0 10upx;"></span>{{rubbishJSName ? rubbishJSName :''}}</view>
  52. <view v-for="item in rubbishJSList" class="rubbishType-item">
  53. <view>{{item.name ? item.name+':' :''}}{{item.customerPrice ? (item.customerPrice/1000).toFixed(2)/1 :0}} 元/kg</view>
  54. </view>
  55. </view>
  56. </view>
  57. </view>
  58. <view class="nodata" v-if="!hasLogin">
  59. <u-empty :text="noDataText" mode="data"></u-empty>
  60. </view>
  61. </view>
  62. </view>
  63. </template>
  64. <script>
  65. import {getBannerList,geRubbishType,orderStatus} from '@/api/index'
  66. import { checkLogin } from '@/api/login.js'
  67. export default {
  68. components: { },
  69. data() {
  70. return {
  71. yuYueBtn:{
  72. background: "#4F88F7",
  73. borderRadius: "12px",
  74. color:'#fff',
  75. },
  76. hasLogin:false, // 是否登录
  77. noDataText:"", // 未登录提示文字
  78. orderStatusText:'', // 订单状态
  79. orderTime:'', //
  80. bannerList:[],
  81. rubbishPaperName:"",
  82. rubbishSLName:"",
  83. rubbishYWName:"",
  84. rubbishJSName:"",
  85. rubbishPaperList:[],
  86. rubbishSLList:[],
  87. rubbishYWList:[],
  88. rubbishJSList:[]
  89. }
  90. },
  91. onLoad() {
  92. this.pageInit()
  93. },
  94. onUnload() {
  95. },
  96. onShareAppMessage(res) {
  97. },
  98. onShareTimeline(res) {
  99. },
  100. onShow() {
  101. checkLogin().then(res => {
  102. this.hasLogin=res.status==200
  103. if(this.hasLogin){
  104. this.pageInit()
  105. }else{
  106. this.noDataText="您尚未登录或登录已过期,完成登录后可查看数据信息!"
  107. }
  108. })
  109. },
  110. methods: {
  111. pageInit() {
  112. this.getBanner()
  113. this.geRubbishTypeList()
  114. this.getOrderStatus()
  115. },
  116. // 获取banner图
  117. getBanner(){
  118. getBannerList().then(res=>{
  119. if(res.status==200){
  120. this.bannerList=res.data || []
  121. }
  122. console.log(res,'-----banner')
  123. })
  124. },
  125. // 获取订单状态
  126. getOrderStatus(){
  127. orderStatus().then(res=>{
  128. if(res.status==200){
  129. this.orderStatusText=res.data.orderStatusDictValue
  130. this.orderTime=res.data.createDate
  131. console.log(res,'----------订单状态')
  132. }
  133. })
  134. },
  135. // 获取垃圾分类
  136. geRubbishTypeList(){
  137. geRubbishType().then(res=>{
  138. if(res.status==200){
  139. console.log(res,'---------垃圾类型')
  140. const a= res.data.find(item=>item.code=='PAPER')
  141. const b= res.data.find(item=>item.code=='PLASTIC')
  142. const c= res.data.find(item=>item.code=='CLOTHES')
  143. const d= res.data.find(item=>item.code=='METAL')
  144. this.rubbishPaperList=a.rubbishTypeVOList
  145. this.rubbishSLList=b.rubbishTypeVOList
  146. this.rubbishYWList=c.rubbishTypeVOList
  147. this.rubbishJSList=d.rubbishTypeVOList
  148. this.rubbishPaperName=a.name
  149. this.rubbishSLName=b.name
  150. this.rubbishYWName=c.name
  151. this.rubbishJSName=d.name
  152. }
  153. })
  154. },
  155. gotoYueYu(){
  156. uni.navigateTo({
  157. url: '/pages/index/yuyue'
  158. })
  159. },
  160. // 回收指引
  161. toZY(){
  162. uni.navigateTo({
  163. url: '/pages/index/zhiyin'
  164. })
  165. },
  166. // 检查更新
  167. checkUpdate(){
  168. // if (uni.canIUse('getUpdateManager')) {
  169. // const updateManager = uni.getUpdateManager()
  170. // updateManager.onCheckForUpdate(function (res) {
  171. // console.log('onCheckForUpdate====', res)
  172. // // 请求完新版本信息的回调
  173. // if (res.hasUpdate) {
  174. // console.log('res.hasUpdate====')
  175. // updateManager.onUpdateReady(function () {
  176. // uni.showModal({
  177. // title: '更新提示',
  178. // content: '新版本已经准备好,是否重启应用?',
  179. // success: function (res) {
  180. // console.log('success====', res)
  181. // // res: {errMsg: "showModal: ok", cancel: false, confirm: true}
  182. // if (res.confirm) {
  183. // // 新的版本已经下载好,调用 applyUpdate 应用新版本并重启
  184. // updateManager.applyUpdate()
  185. // }
  186. // }
  187. // })
  188. // })
  189. // updateManager.onUpdateFailed(function () {
  190. // // 新的版本下载失败
  191. // uni.showModal({
  192. // title: '已经有新版本了哟~',
  193. // content: '新版本已经上线啦~,请您删除当前小程序,重新搜索打开哟~'
  194. // })
  195. // })
  196. // }
  197. // })
  198. // }
  199. },
  200. // scroll-view到底部加载更多
  201. onreachBottom() {
  202. },
  203. // 总计
  204. getTotal(){
  205. // this.titleStatus = true
  206. // gatherTotal({
  207. // beginDate: this.searchForm.beginDate?moment(this.searchForm.beginDate).format('YYYY-MM-DD 00:00:00'):'',
  208. // endDate: this.searchForm.endDate ? moment(this.searchForm.endDate).format('YYYY-MM-DD 23:59:59'):''}).then(res=>{
  209. // if(res.status==200){
  210. // const a = res.data.find(item=>item.rubbishType=='GATHER_BUILDING')
  211. // const b = res.data.find(item=>item.rubbishType=='GATHER_OTHER')
  212. // const c = res.data.find(item=>item.rubbishType=='GATHER_KITCHEN')
  213. // this.jianzhuTotal= a ? (a.rubbishWeight/1000).toFixed(3)/1 : '0'
  214. // this.chuyuTotal= c ? (c.rubbishWeight/1000).toFixed(3)/1 : '0'
  215. // this.otherTotal= b ? (b.rubbishWeight/1000).toFixed(3)/1 : '0'
  216. // }
  217. // console.log(res)
  218. // this.titleStatus = false
  219. // })
  220. },
  221. // 打开垃圾数据录入页面
  222. intoPage(item) {
  223. // const flag=item ? item.gatherId : ''
  224. // console.log(flag,'---------hangid,;;;;')
  225. // let url = flag ? `/pages/index/addData?id=${flag}` : `/pages/index/addData`
  226. // // uni.navigateTo({
  227. // // url: url
  228. // // })
  229. // if(!this.hasLogin){
  230. // uni.showModal({
  231. // title: '提示',
  232. // content: '您尚未登录或登录已过期,请登录后使用',
  233. // success: (res)=> {
  234. // if (res.confirm) {
  235. // uni.navigateTo({
  236. // url: '/pages/login/login'
  237. // })
  238. // } else if (res.cancel) {
  239. // console.log('用户点击取消');
  240. // }
  241. // }
  242. // });
  243. // } else {
  244. // uni.navigateTo({
  245. // url: url
  246. // })
  247. // }
  248. }
  249. }
  250. }
  251. </script>
  252. <style lang="scss" scoped>
  253. .content {
  254. width: 100%;
  255. height: 100vh;
  256. display: flex;
  257. flex-direction: column;
  258. padding: 0;
  259. .content-top{
  260. width: 100%;
  261. height:260upx ;
  262. background-color: #4F88F7;
  263. border-bottom-left-radius: 50%; /* 左下角 */
  264. border-bottom-right-radius:50%; /* 右下角 */
  265. opacity: 1;
  266. .top-banner{
  267. padding: 20upx 30upx 0;
  268. .banner{
  269. width:100%;
  270. height: 140px;
  271. }
  272. }
  273. }
  274. .content-bottom{
  275. padding: 30upx;
  276. background-color: #f5f5f5;
  277. .bottom-new-notice{
  278. background-image: url('../../static/home_bg_expressage.png');
  279. height:220upx;
  280. margin: 30upx 0;
  281. display: flex;
  282. justify-content: space-between;
  283. align-items: center;
  284. padding: 20upx 30upx;
  285. .notice-content{
  286. .notice-content-item{
  287. margin: 15upx 0;
  288. display: flex;
  289. align-items: center;
  290. .item-title{
  291. display: inline-block;
  292. margin-left: 20upx;
  293. }
  294. }
  295. .notice-content-item:last-child{
  296. font-size: 26upx;
  297. font-family: PingFang SC;
  298. font-weight: 400;
  299. color: #7C7D7E;
  300. }
  301. }
  302. .notice-static{
  303. width:186upx;
  304. height: 108upx;
  305. background-image: url('../../static/home_sign_rider.png');
  306. .notice-static-text{
  307. position: relative;
  308. top:21upx;
  309. left:85upx
  310. }
  311. }
  312. }
  313. .bottom-zhiyin{
  314. margin-bottom: 30upx;
  315. }
  316. .statistics-title{
  317. font-size: 36upx;
  318. font-family: PingFang SC;
  319. font-weight: bold;
  320. color: #191919;
  321. opacity: 1;
  322. margin-bottom: 30upx;
  323. }
  324. .bottom-statistics{
  325. display: flex;
  326. width: 100%;
  327. justify-content: space-between;
  328. .statistics-rubbishType{
  329. width: 48%;
  330. .statistics-box{
  331. margin-bottom:30upx ;
  332. background-color: #fff;
  333. padding: 20upx;
  334. border-radius:16upx;
  335. }
  336. .statistics-box:last-child{
  337. margin-bottom:0 ;
  338. }
  339. }
  340. .rubbishType-type{
  341. display: flex;
  342. align-items: center;
  343. justify-content: center;
  344. font-size: 28upx;
  345. font-family: PingFang SC;
  346. font-weight: 400;
  347. color: #000000;
  348. }
  349. .rubbishType-item{
  350. display: flex;
  351. justify-content: center;
  352. margin:10upx 0 ;
  353. font-size: 26upx;
  354. font-family: PingFang SC;
  355. font-weight: 400;
  356. color: #444444;
  357. }
  358. }
  359. }
  360. }
  361. </style>