myBespeak.vue 7.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337
  1. <template>
  2. <view class="box">
  3. <homenav :iStatusBarHeight="iStatusBarHeight" :title="'我的预约'" ></homenav>
  4. <view class="itemHistory" v-for="(item,index) in itemData" :key="index" @click="goDetail(item.ID)">
  5. <view class="carPlate">
  6. <view class="time">{{item.BillDate}}</view>
  7. <view class="mileage" v-if="item.SheetState == 0" style="color: #FF0000">待确认</view>
  8. <view class="mileage" v-if="item.SheetState == 1" style="color: #3F90F7">预约中</view>
  9. <view class="mileage" v-if="item.SheetState == 2" style="color: #00A040;">已到店</view>
  10. <view class="mileage" v-if="item.SheetState == 3">已取消</view>
  11. </view>
  12. <view class="plate">{{item.PlateNumber}}</view>
  13. <view class="shopName">{{item.ShopName}}</view>
  14. <view class="itemN">
  15. <view class="itemContent" v-if="item.OrderItem.length != 0">{{item.OrderItem}}</view>
  16. </view>
  17. </view>
  18. <!-- 上拉 加载更多 -->
  19. <view class="noMore" v-if="noMoreShow && (itemData.length!=0)">没有更多数据</view>
  20. <!-- 无数据空白页 -->
  21. <nodata v-if="itemData.length==0"></nodata>
  22. <!-- 手机号授权 -->
  23. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  24. <view class="authorizCont" @click.stop="">
  25. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  26. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  27. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  28. </view>
  29. <view style="text-align: center;padding-top: 56rpx;">
  30. <image src="../../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  31. </view>
  32. </view>
  33. </view>
  34. </template>
  35. <script>
  36. import nodata from '../../components/nodata/nodata.vue'
  37. import homenav from "../../components/homenav/nav.vue"
  38. export default {
  39. components: {
  40. nodata,homenav
  41. },
  42. data() {
  43. return {
  44. page: 1,
  45. itemData: [],
  46. noMoreShow: false,
  47. iStatusBarHeight:'',
  48. userInfo:'',
  49. ext:'',
  50. wxOpenData:'',
  51. themeColor:'',
  52. authorizShow:false,
  53. code:'',
  54. }
  55. },
  56. onLoad() {
  57. this.iStatusBarHeight = uni.getSystemInfoSync().statusBarHeight;
  58. this.page = 1
  59. //this.myOrderCoupon()
  60. this.userInfo=this.$store.state.userInfo;
  61. this.ext=this.$common.getExtStoreId();
  62. this.themeColor = uni.getStorageSync("themeColor");
  63. if(this.userInfo){
  64. this.myOrderCoupon()
  65. }else{
  66. this.$common.automaticlogin().then(val => {
  67. this.userInfo=this.$store.state.userInfo;
  68. this.wxOpenData=this.$store.state.wxOpenData;
  69. this.themeColor = uni.getStorageSync("themeColor");
  70. this.myOrderCoupon();
  71. if(!this.userInfo){
  72. this.authorizShow=true
  73. }
  74. })
  75. }
  76. },
  77. onShow() {
  78. this.page = 1
  79. this.myOrderCoupon()
  80. },
  81. methods: {
  82. decryptPhoneNumber: function(e) {
  83. console.log(e);
  84. this.code=e.detail.code
  85. this.wxPhoneLogin()
  86. this.authorizShow=false;
  87. },
  88. wxPhoneLogin(){
  89. var that=this;
  90. this.$http('miniApp2/sys/wxPhoneLogin', {
  91. appId:this.ext.appId,
  92. unionId:this.ext.unionId,
  93. code:this.code,
  94. openId:this.wxOpenData.openid
  95. },'POST').then(res => {
  96. var data = res.data;
  97. if(data.loginInfo){
  98. this.userInfo=data.loginInfo.openUser;
  99. this.wxOpenData=data.loginInfo;
  100. this.$store.commit('mutationswxOpenData', data)
  101. this.$store.commit('mutationsuserInfo', this.userInfo)
  102. this.myOrderCoupon()
  103. }
  104. })
  105. },
  106. goDetail(id) {
  107. uni.navigateTo({
  108. url: 'bespeakDetail?id=' + id
  109. })
  110. },
  111. myOrderCoupon() {
  112. uni.showLoading({
  113. title: '加载中'
  114. })
  115. this.$http('openreservation/listOrderSheet', {
  116. // page: this.page,
  117. // limit: 10,
  118. }, 'GET').then(res => {
  119. uni.hideLoading();
  120. // var list = res.data.Items
  121. var list = res.data
  122. // 处理 undefined和null转为空白字符串
  123. // list.forEach((item, index) => {
  124. // for (const key in item) {
  125. // item[key] = this.$praseStrEmpty(item[key])
  126. // }
  127. // })
  128. if (this.page == 1) {
  129. this.itemData = list
  130. } else {
  131. this.itemData = this.itemData.concat(list)
  132. }
  133. if (list.length < 10) {
  134. this.noMoreShow = true
  135. } else {
  136. this.noMoreShow = false
  137. }
  138. })
  139. },
  140. },
  141. // 下拉刷新
  142. onPullDownRefresh() {
  143. this.page = 1
  144. this.myOrderCoupon()
  145. setTimeout(function() {
  146. uni.stopPullDownRefresh();
  147. }, 1000);
  148. },
  149. // 上拉加载更多
  150. onReachBottom() {
  151. // this.page++;
  152. this.myOrderCoupon()
  153. },
  154. }
  155. </script>
  156. <style scoped lang="scss">
  157. .box {
  158. min-height: 100vh;
  159. background-color: #F4F5F7;
  160. padding-top: 20rpx;
  161. }
  162. .itemHistory {
  163. margin: 0rpx 24rpx 20rpx;
  164. padding: 20rpx;
  165. background-color: #FFFFFF;
  166. border-radius: 10rpx;
  167. }
  168. .time {
  169. font-size: 24rpx;
  170. color: #999999;
  171. }
  172. .carPlate {
  173. margin-bottom: 22rpx;
  174. display: flex;
  175. align-items: center;
  176. justify-content: space-between;
  177. }
  178. .plate {
  179. font-size: 30rpx;
  180. color: #3C3C3C;
  181. font-weight: bold;
  182. margin-right: 20rpx;
  183. }
  184. .mileage {
  185. font-size: 24rpx;
  186. color: #999999;
  187. }
  188. .itemN {
  189. display: flex;
  190. }
  191. .shopName{
  192. color: #666666;
  193. font-size: 24rpx;
  194. margin: 16rpx 0rpx;
  195. /* 隐藏文字显示 ...不换行 */
  196. overflow: hidden;
  197. text-overflow: ellipsis;
  198. white-space: nowrap;
  199. }
  200. .itemContent {
  201. color: #666666;
  202. font-size: 24rpx;
  203. /* 隐藏文字显示 ...不换行 */
  204. overflow: hidden;
  205. text-overflow: ellipsis;
  206. white-space: nowrap;
  207. }
  208. .noMore {
  209. text-align: center;
  210. line-height: 50rpx;
  211. color: #999999;
  212. font-size: 28rpx;
  213. }
  214. .authorizBox{
  215. width: 100vw;
  216. height: 100vh;
  217. background: rgba(0, 0, 0, 0.5);
  218. position: fixed;
  219. top: 0;
  220. left: 0;
  221. }
  222. .authorizCont{
  223. margin-top: 30vh;
  224. width: 564rpx;
  225. height: 408rpx;
  226. background: #FFFFFF;
  227. border-radius: 24rpx;
  228. margin-left: 93rpx;
  229. position: relative;
  230. }
  231. .authorizCloseImg{
  232. width: 62rpx;
  233. height: 62rpx;
  234. }
  235. .sqLogoBox{
  236. width: 180rpx;
  237. height: 180rpx;
  238. background: #FFFFFF;
  239. border-radius: 90rpx;
  240. text-align: center;
  241. position: absolute;
  242. top: -50rpx;
  243. left: 192rpx;
  244. }
  245. .authorizName{
  246. color: #333333;
  247. line-height: 42rpx;
  248. font-size: 30rpx;
  249. text-align: center;
  250. padding-top: 58rpx;
  251. }
  252. .authorizMs{
  253. color: #999999;
  254. line-height: 36rpx;
  255. font-size: 26rpx;
  256. width: 452rpx;
  257. padding-top: 24rpx;
  258. text-align: center;
  259. margin-left: 56rpx;
  260. }
  261. .authorizContbutton{
  262. width: 422rpx;
  263. height: 88rpx;
  264. background: #D53533;
  265. border-radius: 44rpx;
  266. line-height: 88rpx;
  267. text-align: center;
  268. font-size:30rpx;
  269. color: #FFFFFF;
  270. margin-top: 62rpx;
  271. margin-left:71rpx;
  272. }
  273. .shopBoxpt{
  274. margin-top: 20rpx;
  275. }
  276. button::after{
  277. border: none;
  278. }
  279. button{
  280. position: relative;
  281. display: block;
  282. margin-left: 0;
  283. margin-right: 0;
  284. padding-left: 0px;
  285. padding-right: 0px;
  286. box-sizing: border-box;
  287. // font-size: 18px;
  288. text-align: center;
  289. text-decoration: none;
  290. // line-height: 1;
  291. line-height: 1.35;
  292. // border-radius: 5px;
  293. -webkit-tap-highlight-color: transparent;
  294. overflow: hidden;
  295. color: #000000;
  296. background-color: #fff;
  297. height: 100%;
  298. }
  299. </style>