cbdetail.vue 6.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314
  1. <template>
  2. <view class="content">
  3. <view class="vheight"></view>
  4. <view class="top flex">
  5. <image @click="back()" class="top-icon1" src="../../static/img/cb2.png" mode=""></image>
  6. <image @click="navTo('/pages/user/cbRecord')" class="top-icon2" src="../../static/img/cb1.png" mode=""></image>
  7. </view>
  8. <view class="title">{{ $t('cb.cb') }}</view>
  9. <view class="type flex" @click="navTo('/pages/transaction/cblist')">
  10. <view class="type-left">{{ $t('cb.bz') }}</view>
  11. <view class="type-right">
  12. <view class="type-name">{{ info.title }}</view>
  13. <image class="type-icon" src="../../static/icon/user-back.png" mode=""></image>
  14. </view>
  15. </view>
  16. <view class="main">
  17. <view class="main-title">{{ $t('cb.cbwl') }}</view>
  18. <view class="main-list">{{ info.czline }}</view>
  19. <view class="main-title" style="margin-top: 20rpx;">{{ $t('cb.cbdz') }}</view>
  20. <view class="erweima">
  21. <tki-qrcode
  22. :cid="cid"
  23. ref="qrcode"
  24. :val="info.czaddress"
  25. :size="size"
  26. :unit="unit"
  27. :background="background"
  28. :foreground="foreground"
  29. :pdground="pdground"
  30. :iconSize="iconSize"
  31. :lv="lv"
  32. :onval="onval"
  33. :loadMake="loadMake"
  34. :usingComponents="usingComponents"
  35. @result="qrR"
  36. />
  37. </view>
  38. <view class="address">{{ info.czaddress }}</view>
  39. <view class="btn" @click="copy(info.czaddress)">{{ $t('cb.fzdz') }}</view>
  40. </view>
  41. <view class="info">
  42. <view class="info-item red">{{ $t('cb.zxczje') }}:{{ info.czminnum }}{{ info.title }},{{ $t('cb.xyzxje') }}</view>
  43. <view class="info-item">{{ $t('cb.qxzzqd') }}</view>
  44. <view class="info-item">{{ $t('cb.zxczje') }}:{{ info.czminnum }}{{ info.title }},{{ $t('cb.xyzxje') }}</view>
  45. <view class="info-item">{{ $t('cb.ndczdz') }}</view>
  46. <view class="info-item">{{ $t('cb.qwbqrdn') }}</view>
  47. </view>
  48. <view class="sr">
  49. <view class="sr-title">{{ $t('cb.zzje') }}</view>
  50. <view class="sr-input"><input :placeholder="$t('cb.qsrzzje')" type="number" v-model="num" /></view>
  51. <view class="sr-title" style="margin-top: 20rpx;">{{ $t('cb.xczzpz') }}</view>
  52. <view class="sr-image">
  53. <image :src="image" mode="" class="upload-img" @click.stop="imgsub" v-if="image"></image>
  54. <image src="../../static/img/add.png" class="upload-img" mode="" v-if="!image" @click.stop="imgsub"></image>
  55. </view>
  56. <view class="sr-btn" @click="submit()">{{ $t('cb.tj') }}</view>
  57. </view>
  58. </view>
  59. </template>
  60. <script>
  61. import { czpage, upload, paycoin } from '@/api/wallet.js';
  62. import tkiQrcode from '@/components/tki-qrcode/tki-qrcode.vue';
  63. import uniCopy from '@/js_sdk/xb-copy/uni-copy.js';
  64. export default {
  65. data() {
  66. return {
  67. id: '',
  68. info: '',
  69. cid: 'cid',
  70. size: 100,
  71. unit: '150',
  72. background: '#FFFFFF',
  73. foreground: '#000000',
  74. pdground: '#000000',
  75. icon: '',
  76. iconSize: 40,
  77. lv: 3,
  78. onval: true,
  79. loadMake: true,
  80. usingComponents: true,
  81. num: '',
  82. image: '',
  83. image1: ''
  84. };
  85. },
  86. onLoad(opt) {
  87. this.id = opt.type;
  88. this.loadData();
  89. },
  90. onShow() {},
  91. onReachBottom() {},
  92. onReady() {},
  93. methods: {
  94. loadData() {
  95. czpage({ id: this.id }).then(e => {
  96. this.info = e.data;
  97. });
  98. },
  99. qrR(res) {
  100. console.log(res, '123456');
  101. },
  102. back() {
  103. uni.navigateBack();
  104. },
  105. navTo(url) {
  106. uni.navigateTo({
  107. url
  108. });
  109. },
  110. imgsub() {
  111. console.log(111);
  112. upload({
  113. filename: ''
  114. }).then(data => {
  115. console.log('data', data);
  116. this.image = data[0].src;
  117. this.image1 = data[0].img;
  118. });
  119. },
  120. copy(item) {
  121. let obj = this;
  122. let content = item; //需要复制的内容
  123. content = typeof content === 'string' ? content : content.toString(); // 复制内容,必须字符串,数字需要转换为字符串
  124. const result = uniCopy(content);
  125. if (result === false) {
  126. uni.showToast({
  127. title: '不支持'
  128. });
  129. } else {
  130. uni.showToast({
  131. title: '複製成功',
  132. icon: 'none'
  133. });
  134. }
  135. },
  136. submit() {
  137. console.log(222);
  138. if (this.num < 0) {
  139. return this.$api.msg(this.$t('cb.czjebnw'));
  140. }
  141. if (!this.image1) {
  142. return this.$api.msg(this.$t('cb.qcszzpz'));
  143. }
  144. paycoin({ cid: this.id, zznum: this.num, payimg: this.image1, coinname: this.info.title }).then(e => {
  145. this.num = '';
  146. this.image = '';
  147. return this.$api.msg(this.$t('cb.tjsqcg'));
  148. });
  149. }
  150. }
  151. };
  152. </script>
  153. <style lang="scss">
  154. page,
  155. .content {
  156. min-height: 100%;
  157. height: auto;
  158. background: #f5f5f5;
  159. }
  160. .vheight {
  161. height: var(--status-bar-height);
  162. background: #f5f5f5;
  163. }
  164. .top {
  165. padding: 20rpx 40rpx;
  166. .top-icon1 {
  167. width: 52rpx;
  168. height: 36rpx;
  169. }
  170. .top-icon2 {
  171. width: 48rpx;
  172. height: 48rpx;
  173. }
  174. }
  175. .title {
  176. padding: 20rpx 20rpx 0;
  177. font-size: 52rpx;
  178. font-weight: 500;
  179. }
  180. .type {
  181. margin: 20rpx auto 0;
  182. width: 690rpx;
  183. background: #ffffff;
  184. border-radius: 20rpx;
  185. padding: 30rpx 20rpx;
  186. .type-left {
  187. font-size: 32rpx;
  188. color: #000;
  189. }
  190. .type-right {
  191. display: flex;
  192. align-items: center;
  193. .type-name {
  194. font-size: 36rpx;
  195. font-weight: bold;
  196. color: #fcd535;
  197. margin-right: 10rpx;
  198. }
  199. .type-icon {
  200. width: 24rpx;
  201. height: 24rpx;
  202. }
  203. }
  204. }
  205. .main {
  206. margin: 20rpx auto 0;
  207. width: 690rpx;
  208. background: #ffffff;
  209. border-radius: 20rpx;
  210. padding: 30rpx 20rpx;
  211. .main-title {
  212. font-size: 32rpx;
  213. color: #000;
  214. }
  215. .main-list {
  216. margin-top: 20rpx;
  217. width: 200rpx;
  218. height: 70rpx;
  219. line-height: 70rpx;
  220. text-align: center;
  221. border: 2px solid #fcd535;
  222. border-radius: 10rpx;
  223. font-size: 28rpx;
  224. color: #fcd535;
  225. }
  226. .erweima {
  227. margin-top: 40rpx;
  228. width: 100%;
  229. display: flex;
  230. justify-content: center;
  231. }
  232. .address {
  233. margin-top: 20rpx;
  234. width: 100%;
  235. text-align: center;
  236. font-size: 24rpx;
  237. color: #000;
  238. }
  239. .btn {
  240. width: 200rpx;
  241. height: 60rpx;
  242. line-height: 60rpx;
  243. text-align: center;
  244. border-radius: 10rpx;
  245. border: 2px solid #fcd535;
  246. font-size: 28rpx;
  247. color: #fcd535;
  248. margin: 20rpx auto 0;
  249. }
  250. }
  251. .info {
  252. margin: 20rpx auto 0;
  253. width: 690rpx;
  254. background: #ffffff;
  255. border-radius: 20rpx;
  256. padding: 30rpx 20rpx;
  257. .info-item {
  258. font-size: 24rpx;
  259. color: #000;
  260. margin-bottom: 20rpx;
  261. }
  262. .red {
  263. color: red;
  264. }
  265. }
  266. .sr {
  267. margin: 20rpx auto 0;
  268. width: 690rpx;
  269. background: #ffffff;
  270. border-radius: 20rpx;
  271. padding: 30rpx 20rpx;
  272. .sr-title {
  273. font-size: 32rpx;
  274. color: #000;
  275. }
  276. .sr-input {
  277. display: flex;
  278. align-items: center;
  279. width: 100%;
  280. height: 80rpx;
  281. line-height: 80rpx;
  282. background: #f5f5f5;
  283. border-radius: 20rpx;
  284. padding: 0rpx 30rpx;
  285. input {
  286. font-size: 28rpx;
  287. padding-left: 30rpx;
  288. background: #f5f5f5;
  289. }
  290. }
  291. .sr-image {
  292. display: flex;
  293. justify-content: center;
  294. margin: 20rpx;
  295. image {
  296. width: 200rpx;
  297. height: 200rpx;
  298. }
  299. }
  300. .sr-btn {
  301. width: 100%;
  302. height: 80rpx;
  303. line-height: 80rpx;
  304. text-align: center;
  305. border-radius: 10rpx;
  306. margin: 20rpx auto 0;
  307. background: linear-gradient(to left, #eeb80d, #ffe35b);
  308. font-size: 28rpx;
  309. color: #000;
  310. }
  311. }
  312. </style>