bonus.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. <template>
  2. <view class="box">
  3. <view style="height: 20rpx;"></view>
  4. <view class="line" v-for="(item,index) in list">
  5. <view class="linetop">
  6. <view class="name">{{item.CustomerName}}</view>
  7. <view class="amount">¥{{item.BonusMoney}}</view>
  8. </view>
  9. <view class="lineCOnt">
  10. <view class="lineline">
  11. <view class="lineContLeft">
  12. <image src="../../static/timg/icon_dianhua.png" mode="" class="lineContLeftImg"></image>
  13. <view class="lineContLeftMs">{{item.MobilePhone}}</view>
  14. </view>
  15. </view>
  16. <view class="lineline">
  17. <view class="lineContLeft">
  18. <image src="../../static/timg/icon_danhao.png" mode="" class="lineContLeftImg"></image>
  19. <view class="lineContLeftMs">{{item.Code}}</view>
  20. </view>
  21. <view class="lineTIme">{{item.BillDate}}</view>
  22. </view>
  23. </view>
  24. </view>
  25. <nodata v-if="list.length==0"></nodata>
  26. <!-- 手机号授权 -->
  27. <view class="authorizBox" v-if="authorizShow" @click="authorizShow=false">
  28. <view class="authorizCont" @click.stop="">
  29. <view class="authorizName">{{wxOpenData.miniAppName}}</view>
  30. <view class="authorizMs">您好,欢迎访问本店,授权手机号登录能获取我们最新的促销活动哦~</view>
  31. <button class="authorizContbutton" type="default" open-type="getPhoneNumber" @getphonenumber="decryptPhoneNumber">授权</button>
  32. </view>
  33. <view style="text-align: center;padding-top: 56rpx;">
  34. <image src="../../static/timg/icon_guanbi@2x.png" mode="" class="authorizCloseImg"></image>
  35. </view>
  36. </view>
  37. </view>
  38. </template>
  39. <script>
  40. import nodata from '../../components/nodata/nodata.vue'
  41. export default {
  42. components: {
  43. nodata
  44. },
  45. data() {
  46. return {
  47. list:[],
  48. themeColor:'',
  49. userInfo:'',
  50. page:1,
  51. limit:20,
  52. authorizShow:false,
  53. userInfo:'',
  54. ext:'',
  55. wxOpenData:'',
  56. }
  57. },
  58. onLoad(opt) {
  59. this.themeColor = uni.getStorageSync("themeColor");
  60. //this.userInfo = uni.getStorageSync("userInfo");
  61. this.userInfo = this.$store.state.userInfo;
  62. this.userInfo=this.$store.state.userInfo;
  63. this.ext=this.$common.getExtStoreId();
  64. if(this.userInfo){
  65. this.getList()
  66. }else{
  67. this.$common.automaticlogin().then(val => {
  68. this.userInfo=this.$store.state.userInfo;
  69. this.wxOpenData=this.$store.state.wxOpenData;
  70. this.themeColor = uni.getStorageSync("themeColor");
  71. if(!this.userInfo){
  72. this.authorizShow=true
  73. }
  74. this.getList()
  75. })
  76. }
  77. },
  78. onShow() {
  79. },
  80. methods: {
  81. getList(){
  82. uni.showLoading({
  83. title: '加载中'
  84. })
  85. this.$http('opencarInfoOwner/listBonusPage', {
  86. page:this.page,limit:this.limit,
  87. }, 'GET').then(res => {
  88. uni.hideLoading();
  89. //this.list = res.data.Items
  90. var data=res.data.Items;
  91. this.list=this.list.concat(data);
  92. //console.log('list+=', this.queryShopList);
  93. })
  94. },
  95. decryptPhoneNumber: function(e) {
  96. console.log(e);
  97. this.code=e.detail.code
  98. this.wxPhoneLogin()
  99. this.authorizShow=false;
  100. },
  101. wxPhoneLogin(){
  102. var that=this;
  103. this.$http('miniApp2/sys/wxPhoneLogin', {
  104. appId:this.ext.appId,
  105. unionId:this.ext.unionId,
  106. code:this.code,
  107. openId:this.wxOpenData.openid
  108. },'POST').then(res => {
  109. var data = res.data;
  110. if(data.newCustomer){
  111. uni.showModal({
  112. title: '提示',
  113. content: data.newCustomerMsg,
  114. success: function(resTK) {
  115. }
  116. });
  117. var token=res.data.token
  118. data.loginInfo={}
  119. data.loginInfo.token=token
  120. this.$store.commit('mutationswxOpenData', data);
  121. return false;
  122. }
  123. if(data.loginInfo){
  124. this.userInfo=data.loginInfo.openUser;
  125. this.wxOpenData=data.loginInfo;
  126. this.$store.commit('mutationswxOpenData', data)
  127. this.$store.commit('mutationsuserInfo', this.userInfo)
  128. this.list=[]
  129. this.getList()
  130. }
  131. })
  132. },
  133. },
  134. onReachBottom(){
  135. this.page++;
  136. this.getList()
  137. //console.log("shanglas")
  138. },
  139. onPullDownRefresh(){
  140. this.page=1;
  141. this.list=[];
  142. this.getList();
  143. setTimeout(() => {
  144. uni.stopPullDownRefresh(); // 关闭下拉刷新
  145. }, 2000);
  146. }
  147. }
  148. </script>
  149. <style scoped lang="less">
  150. .box {
  151. width: 100vw;
  152. min-height: 100vh;
  153. background: #F4F5F7;
  154. }
  155. .lineContLeftImg{
  156. width: 30rpx;
  157. height: 30rpx;
  158. margin-right: 10rpx;
  159. }
  160. .line{
  161. width: 702rpx;
  162. background: #FFFFFF;
  163. border-radius: 10rpx;
  164. margin-bottom: 20rpx;
  165. margin-left: 24rpx;
  166. }
  167. .linetop{
  168. display: flex;
  169. justify-content: space-between;
  170. font-size: 30rpx;
  171. padding: 20rpx;
  172. padding-bottom: 0;
  173. }
  174. .lineline{
  175. display: flex;
  176. justify-content: space-between;
  177. padding: 20rpx;
  178. font-weight: 400;
  179. color: #999999;
  180. font-size: 24rpx;
  181. line-height: 30rpx;
  182. }
  183. .lineContLeft{
  184. display: flex;
  185. }
  186. .name{
  187. font-weight: 500;
  188. color: #3C3C3C;
  189. }
  190. .amount{
  191. color: #FF0000;font-weight: 500;
  192. }
  193. .authorizBox{
  194. width: 100vw;
  195. height: 100vh;
  196. background: rgba(0, 0, 0, 0.5);
  197. position: fixed;
  198. top: 0;
  199. left: 0;
  200. }
  201. .authorizCont{
  202. margin-top: 30vh;
  203. width: 564rpx;
  204. height: 408rpx;
  205. background: #FFFFFF;
  206. border-radius: 24rpx;
  207. margin-left: 93rpx;
  208. position: relative;
  209. }
  210. .authorizCloseImg{
  211. width: 62rpx;
  212. height: 62rpx;
  213. }
  214. .sqLogoBox{
  215. width: 180rpx;
  216. height: 180rpx;
  217. background: #FFFFFF;
  218. border-radius: 90rpx;
  219. text-align: center;
  220. position: absolute;
  221. top: -50rpx;
  222. left: 192rpx;
  223. }
  224. .authorizName{
  225. color: #333333;
  226. line-height: 42rpx;
  227. font-size: 30rpx;
  228. text-align: center;
  229. padding-top: 58rpx;
  230. }
  231. .authorizMs{
  232. color: #999999;
  233. line-height: 36rpx;
  234. font-size: 26rpx;
  235. width: 452rpx;
  236. padding-top: 24rpx;
  237. text-align: center;
  238. margin-left: 56rpx;
  239. }
  240. .authorizContbutton{
  241. width: 422rpx;
  242. height: 88rpx;
  243. background: #D53533;
  244. border-radius: 44rpx;
  245. line-height: 88rpx;
  246. text-align: center;
  247. font-size:30rpx;
  248. color: #FFFFFF;
  249. margin-top: 62rpx;
  250. margin-left:71rpx;
  251. }
  252. </style>