integral.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340
  1. <template>
  2. <view>
  3. <form :style="colorStyle">
  4. <view class="payment-top acea-row row-column row-center-wrapper">
  5. <span class="name">我的消费分</span>
  6. <view class="pic">
  7. <span class="pic-font">{{userinfo.integral || 0.00}}</span>
  8. </view>
  9. </view>
  10. <view class="payment">
  11. <view class="tip picList">
  12. <view class='to_uid acea-row row-between'>
  13. <view class="title">转账数量</view>
  14. <input class="uidbox" v-model="number" placeholder="0.00"
  15. type='number' placeholder-class='placeholderUid' name="number"></input>
  16. </view>
  17. <view class='to_uid acea-row row-between'>
  18. <view class="title">用户UID</view>
  19. <input class="uidbox" placeholder-class='placeholderUid' placeholder="请输入转入的用户uid" v-model="uid" type='number' name="uid"></input>
  20. <!-- #ifndef H5 -->
  21. <image @click="qr" class="tipimg" src="../../../static/images/qrSq.png" mode=""></image>
  22. <!-- #endif -->
  23. </view>
  24. </view>
  25. <view class="tips-title" v-if="userinfo.shop_integral_trade_commission">
  26. <view style="font-weight: bold; font-size: 26rpx;">提示:</view>
  27. <view style="margin-top: 10rpx;">当前手续费为 <text
  28. class='font-color'>{{userinfo.shop_integral_trade_commission*number/100}}</text></view>
  29. </view>
  30. <button class='but bg-color' @click="submitSub"> 立即转换</button>
  31. </view>
  32. </form>
  33. <home v-if="navigation"></home>
  34. <!-- <view v-show="false" v-html="formContent"></view> -->
  35. <!-- #ifdef MP -->
  36. <!-- <authorize v-if="isShowAuth" @authColse="authColse" @onLoadFun="onLoadFun"></authorize> -->
  37. <!-- #endif -->
  38. </view>
  39. </template>
  40. <script>
  41. import {
  42. getUserInfo,
  43. integralTrade
  44. } from '@/api/user.js';
  45. import {
  46. toLogin
  47. } from '@/libs/login.js';
  48. import {
  49. mapGetters
  50. } from "vuex";
  51. import home from '@/components/home';
  52. import colors from "@/mixins/color";
  53. export default {
  54. components: {
  55. home,
  56. },
  57. mixins: [colors],
  58. data() {
  59. let that = this;
  60. return {
  61. number: '',
  62. uid: '', //转入用户UID
  63. userinfo: {},
  64. // #ifdef H5
  65. isWeixin: this.$wechat.isWeixin(),
  66. // #endif
  67. };
  68. },
  69. computed: mapGetters(['isLogin']),
  70. watch: {
  71. isLogin: {
  72. handler: function(newV, oldV) {
  73. if (newV) {
  74. this.getUserInfo();
  75. }
  76. },
  77. deep: true
  78. }
  79. },
  80. onLoad(options) {
  81. if (this.isLogin) {
  82. this.getUserInfo();
  83. } else {
  84. toLogin();
  85. }
  86. },
  87. onShow() {},
  88. methods: {
  89. onLunch() {
  90. this.getUserInfo();
  91. },
  92. inputNum: function(e) {
  93. let val = e.detail.value;
  94. let dot = val.indexOf('.');
  95. if (dot > -1) {
  96. this.moneyMaxLeng = dot + 3;
  97. } else {
  98. this.moneyMaxLeng = 8
  99. }
  100. },
  101. onLoadFun: function() {
  102. this.getUserInfo();
  103. },
  104. // #ifndef H5
  105. qr() {
  106. const that = this;
  107. uni.scanCode({
  108. success: function(res) {
  109. console.log('条码类型:' + res.scanType);
  110. console.log('条码内容:' + res.result);
  111. that.uid = res.result;
  112. }
  113. });
  114. },
  115. // #endif
  116. /**
  117. * 获取用户信息
  118. */
  119. getUserInfo: function() {
  120. let that = this;
  121. getUserInfo().then(res => {
  122. that.$set(that, 'userinfo', res.data);
  123. })
  124. },
  125. submitSub: function(e) {
  126. let that = this
  127. let value = that.number;
  128. if (parseFloat(value) < 0 || parseFloat(value) == NaN || value == undefined || value == "") {
  129. return that.$util.Tips({
  130. title: '请输入数量'
  131. });
  132. }
  133. // 转入余额
  134. uni.showModal({
  135. title: '消费分转账',
  136. content: '佣金转出后无法撤回,确认是否转出消费分',
  137. success(res) {
  138. if (res.confirm) {
  139. integralTrade({
  140. to_uid: that.uid,
  141. num: parseFloat(value),
  142. }).then(res => {
  143. // that.$set(that, 'userinfo.now_money', that.$util.$h.Add(value, that.userinfo.now_money))
  144. return that.$util.Tips({
  145. title: '转入成功',
  146. icon: 'success'
  147. }, {
  148. tab: 5,
  149. url: '/pages/user/index'
  150. });
  151. }).catch(err => {
  152. return that.$util.Tips({
  153. title: err
  154. })
  155. });
  156. } else if (res.cancel) {
  157. return that.$util.Tips({
  158. title: '已取消'
  159. });
  160. }
  161. },
  162. })
  163. }
  164. }
  165. }
  166. </script>
  167. <style lang="scss">
  168. page {
  169. width: 100%;
  170. height: 100%;
  171. background-color: #fff;
  172. }
  173. .bgcolor {
  174. background-color: var(--view-theme)
  175. }
  176. .payment {
  177. position: relative;
  178. width: 100%;
  179. background-color: #fff;
  180. border-radius: 10rpx;
  181. padding-top: 25rpx;
  182. border-top-right-radius: 39rpx;
  183. border-top-left-radius: 39rpx;
  184. }
  185. .payment .nav {
  186. height: 75rpx;
  187. line-height: 75rpx;
  188. padding: 0 100rpx;
  189. }
  190. .payment .nav .item {
  191. font-size: 30rpx;
  192. color: #333;
  193. }
  194. .payment .nav .item.on {
  195. font-weight: bold;
  196. border-bottom: 4rpx solid var(--view-theme);
  197. }
  198. .payment .input {
  199. display: flex;
  200. align-items: center;
  201. justify-content: center;
  202. border-bottom: 1px dashed #dddddd;
  203. margin: 60rpx auto 0 auto;
  204. padding-bottom: 20rpx;
  205. font-size: 56rpx;
  206. color: #333333;
  207. flex-wrap: nowrap;
  208. }
  209. .payment .input text {
  210. padding-left: 106rpx;
  211. }
  212. .payment .input input {
  213. padding-right: 106rpx;
  214. width: 300rpx;
  215. height: 94rpx;
  216. text-align: center;
  217. font-size: 70rpx;
  218. }
  219. .payment .placeholder {
  220. color: #d0d0d0;
  221. height: 100%;
  222. line-height: 94rpx;
  223. }
  224. .payment .tip {
  225. font-size: 26rpx;
  226. color: #888888;
  227. padding: 0 30rpx;
  228. margin-top: 25rpx;
  229. }
  230. .payment .but {
  231. color: #fff;
  232. font-size: 30rpx;
  233. height: 100rpx;
  234. border-radius: 10rpx;
  235. margin: 46rpx 50rpx 0 50rpx;
  236. line-height: 100rpx;
  237. background-image: linear-gradient(45deg, #ffcdd3, #ffb0b3);
  238. }
  239. .payment-top {
  240. width: 100%;
  241. height: 350rpx;
  242. // background-color: var(--view-theme);
  243. background-image: linear-gradient(45deg, rgb(255, 242, 232) 10%, #fff0f2 35%, rgb(255, 234, 247) 45%, #ffcdd3 75%, #ffb0b3);
  244. .name {
  245. font-size: 26rpx;
  246. color: rgba(255, 255, 255, 0.8);
  247. margin-top: -38rpx;
  248. margin-bottom: 30rpx;
  249. }
  250. .pic {
  251. font-size: 32rpx;
  252. color: #fff;
  253. }
  254. .pic-font {
  255. font-size: 78rpx;
  256. color: #fff;
  257. }
  258. }
  259. .picList {
  260. margin: 30rpx 0;
  261. }
  262. .tips-box {
  263. .tips {
  264. font-size: 28rpx;
  265. color: #333333;
  266. font-weight: 800;
  267. margin-bottom: 14rpx;
  268. margin-top: 20rpx;
  269. }
  270. .tips-samll {
  271. font-size: 24rpx;
  272. color: #333333;
  273. margin-bottom: 14rpx;
  274. }
  275. .tip-box {
  276. margin-top: 30rpx;
  277. }
  278. }
  279. .tips-title {
  280. padding-left: 30rpx;
  281. margin-top: 20rpx;
  282. font-size: 24rpx;
  283. color: #333;
  284. }
  285. .to_uid {
  286. padding: 20rpx;
  287. width: 100%;
  288. line-height: 1;
  289. font-size: 28rpx;
  290. align-items: center;
  291. border-bottom: 1px solid #dddddd;
  292. .title {
  293. font-weight: bold;
  294. }
  295. .uidbox {
  296. flex-grow: 1;
  297. text-align: right;
  298. }
  299. .placeholderUid {
  300. text-align: right;
  301. }
  302. }
  303. .tipimg {
  304. width: 50rpx;
  305. height: 50rpx;
  306. margin-left: 10rpx;
  307. }
  308. </style>