details.vue 8.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372
  1. <template>
  2. <view class="content">
  3. <!-- <view class="flex_item coupon">
  4. <view class="coupon_img"><image src="/static/xpy/025.png"></image></view>
  5. <view class="coupon_name">
  6. <view class="coupon_text">星拼乐100元商城购物卡通用元商城购物卡通用</view>
  7. <view class="coupon_money">¥100</view>
  8. </view>
  9. </view> -->
  10. <view class="row-box">
  11. <view class="title">付款金额</view>
  12. <view class="row">
  13. <text class="tit">¥</text>
  14. <input class="input" type="number" v-model="money" placeholder="请输入转让金额" placeholder-class="placeholder" />
  15. </view>
  16. <button class="add-btn up" :class="{ 'active-bg': payLoding }" @click="!payLoding ? confirm() : ''">生成二维码</button>
  17. </view>
  18. <view class="coupon_transfer" v-if="showcode">
  19. <view class="erwema">
  20. <tki-qrcodes
  21. :cid="cid"
  22. ref="qrcode"
  23. :val="val"
  24. :size="size"
  25. :unit="unit"
  26. :background="background"
  27. :foreground="foreground"
  28. :pdground="pdground"
  29. :icon="icon"
  30. :iconSize="iconSize"
  31. :lv="lv"
  32. :onval="onval"
  33. :loadMake="loadMake"
  34. :usingComponents="usingComponents"
  35. @result="qrR"
  36. ></tki-qrcodes>
  37. </view>
  38. <view class="upload" @click="upload()">复制二维码</view>
  39. <view class="transfer">通过扫描此二维码转让购物卡</view>
  40. <!-- <view class="transfer_image" @click="baocun(image)"><image :src="image"></image></view> -->
  41. </view>
  42. <!-- <view class="orderDetialBox">
  43. <view class="f-header m-t">
  44. <view class="f-left-ic····························on"></view>
  45. <view class="tit-box"><text class="tit">卡片信息</text></view>
  46. </view>
  47. <view class="item flex">
  48. <view class="title-left flex">
  49. <text class="title">订单编号:</text>
  50. <view class="text">45875487854</view>
  51. </view>
  52. </view>
  53. <view class="item flex">
  54. <view class="title-left flex">
  55. <text class="title">付款时间:</text>
  56. <view class="text">2018-09-09 12:00:31</view>
  57. </view>
  58. </view>
  59. <view class="item flex">
  60. <view class="title-left flex">
  61. <text class="title">拼中时间:</text>
  62. <view class="text">2018-09-09 12:00:31</view>
  63. </view>
  64. </view>
  65. </view> -->
  66. </view>
  67. </template>
  68. <script>
  69. import { rechargemoneys } from '@/api/wallet.js';
  70. import tkiQrcodes from '@/components/tki-qrcode/tki-qrcode.vue';
  71. import { orderDetail } from '@/api/order.js';
  72. export default {
  73. components: { tkiQrcodes },
  74. props: {
  75. qrval: {
  76. // 要生成的二维码值
  77. type: String
  78. }
  79. },
  80. data() {
  81. return {
  82. image: 'http://img03.taobaocdn.com/tfscom/TB2Drm1jVXXXXakXpXXXXXXXXXX_!!2-dgshop.png_300x300.jpg',
  83. payLoding: false, //是否加载中
  84. showcode: false, //显示二维码页面
  85. money: '',
  86. url: '',
  87. uid: '',
  88. qrsize: 120, // 二维码大小
  89. cid: 'tki-qrcode-canvas', //canvasId,页面存在多个二维码组件时需设置不同的ID
  90. size: 180, //生成的二维码大小
  91. unit: 'upx', //大小单位尺寸
  92. // show: true,//默认使用组件中的image标签显示二维码
  93. val: '', //要生成的内容
  94. background: '#ffffff', //二维码背景色
  95. foreground: '#333333', //二维码前景色
  96. pdground: '#333333', //二维码角标色
  97. icon: '', //二维码图标URL(必须是本地图片,网络图需要先下载至本地)
  98. iconSize: 40, //二维码图标大小
  99. lv: 3, //容错级别
  100. onval: true, //监听val值变化自动重新生成二维码
  101. loadMake: false, //组件初始化完成后自动生成二维码,val需要有值
  102. usingComponents: false, //是否使用了自定义组件模式(主要是为了修复非自定义组件模式时 v-if 无法生成二维码的问题)
  103. showLoading: false, //是否显示loading
  104. loadingText: '二维码生成中', //loading文字
  105. src: '', // 二维码生成后的图片地址或base64
  106. ratio: 1, //页面比例用于计算
  107. ctxSrc: '', //要显示的图片
  108. loading: true, //是否载入图片中
  109. canHeight: '',
  110. canWeidth: ''
  111. };
  112. },
  113. onLoad() {
  114. this.loadlist;
  115. let value = uni.getStorageSync('userInfo');
  116. this.uid = value.uid;
  117. },
  118. methods: {
  119. // 創建二维码
  120. creatQrcode() {
  121. console.log(this.$refs.qrcode._makeCode);
  122. this.$refs.qrcode._makeCode();
  123. },
  124. // 保存二维码到图库
  125. saveQrcode() {
  126. this.$refs.qrcode._saveCode();
  127. },
  128. // 生成二维码后返回base64
  129. qrR(res) {
  130. this.src = res;
  131. },
  132. //清空二维码(清空二维码会触发result回调 返回值为空)
  133. clearQrcode(e) {
  134. this.$refs.qrcode._clearCode();
  135. this.val = '';
  136. },
  137. // 载入订单详细
  138. loadlist() {},
  139. // 提交
  140. confirm() {
  141. let obj = this;
  142. if (!obj.money || obj.money == '') {
  143. uni.showToast({
  144. title: '请填写转让金额',
  145. icon: 'none',
  146. duration: 2000
  147. });
  148. return;
  149. }
  150. obj.showcode = true;
  151. obj.payLoding = true;
  152. /**rechargemoneys({
  153. money: obj.money,
  154. })
  155. .then(e => {
  156. console.log(e.data)
  157. obj.val='{"url":"'+e.data.url+'"}';
  158. })
  159. .catch(e => {
  160. uni.showModal({
  161. title: '失败',
  162. content: '转入失败',
  163. content: JSON.stringify(e),
  164. showCancel: false
  165. });
  166. });**/
  167. obj.val = '{"money":"' + obj.money + '","id":"' + obj.uid + '"}';
  168. this.$nextTick(function() {
  169. this.creatQrcode();
  170. });
  171. },
  172. upload() {
  173. this.$refs.qrcode._saveCode();
  174. }
  175. }
  176. };
  177. </script>
  178. <style lang="scss">
  179. page {
  180. background: $page-color-base;
  181. }
  182. .asdf {
  183. width: 110rpx;
  184. height: 110rpx;
  185. }
  186. .content {
  187. border-top: 2rpx solid #f2f3f5;
  188. }
  189. // 订单详细
  190. .orderDetialBox {
  191. margin-top: 20rpx;
  192. padding: 0 30rpx;
  193. background-color: #ffffff;
  194. font-size: $font-base;
  195. color: $font-color-base;
  196. .item {
  197. height: 80rpx;
  198. .text {
  199. padding-left: 10rpx;
  200. }
  201. .buttom-right {
  202. width: 180rpx;
  203. border-radius: 99rpx;
  204. padding: 10rpx;
  205. text-align: center;
  206. border: 1px solid $border-color-light;
  207. }
  208. }
  209. }
  210. // 标题头
  211. .f-header {
  212. display: flex;
  213. align-items: center;
  214. height: 80rpx;
  215. .tit-box {
  216. @extend %font-title-box;
  217. border-bottom: 2rpx solid #f0f0f0;
  218. padding: 25rpx 0rpx;
  219. }
  220. .tit {
  221. @extend %font-title;
  222. }
  223. .f-left-icon {
  224. @extend %f-left-icon;
  225. }
  226. }
  227. // 共有底部高度
  228. $btHeight: 100rpx;
  229. .btHeight {
  230. height: $btHeight;
  231. }
  232. .coupon {
  233. width: 100%;
  234. background-color: #ffffff;
  235. padding: 25rpx 25rpx;
  236. font-size: 30rpx;
  237. .coupon_img {
  238. width: 200rpx;
  239. height: 118rpx;
  240. margin-right: 15rpx;
  241. image {
  242. width: 100%;
  243. height: 100%;
  244. }
  245. }
  246. .coupon_name {
  247. height: 118rpx;
  248. width: 70%;
  249. .coupon_text {
  250. padding-bottom: 25rpx;
  251. white-space: nowrap;
  252. overflow: hidden;
  253. text-overflow: ellipsis;
  254. font-weight: bold;
  255. color: rgba(51, 51, 51, 1);
  256. }
  257. .coupon_money {
  258. font-weight: 500;
  259. color: rgba(102, 102, 102, 1);
  260. .coupon_time {
  261. padding-left: 25rpx;
  262. }
  263. }
  264. }
  265. }
  266. .coupon_transfer {
  267. background-color: #ffffff;
  268. padding: 40rpx 25rpx;
  269. width: 100%;
  270. height: 100%;
  271. margin-top: 25rpx;
  272. }
  273. .transfer_image {
  274. width: 100%;
  275. height: 220rpx;
  276. text-align-last: center;
  277. }
  278. .transfer_image image {
  279. width: 220rpx;
  280. height: 220rpx;
  281. }
  282. .upload {
  283. width: 28%;
  284. background: linear-gradient(90deg, rgba(253, 59, 51, 1) 0%, rgba(254, 75, 52, 1) 100%);
  285. border-radius: 10rpx;
  286. color: #ffffff;
  287. font-size: 26rpx;
  288. margin: 25rpx auto;
  289. padding: 20rpx 30rpx;
  290. text-align: center;
  291. }
  292. .transfer {
  293. width: 100%;
  294. text-align: center;
  295. font-size: 26rpx;
  296. }
  297. .row-box {
  298. margin-top: 30rpx;
  299. padding: 20rpx 30rpx;
  300. background: #fff;
  301. .title {
  302. font-size: $font-base + 2rpx;
  303. color: $font-color-dark;
  304. padding-bottom: 25rpx;
  305. }
  306. .row {
  307. display: flex;
  308. align-items: center;
  309. position: relative;
  310. height: 80rpx;
  311. .tit {
  312. flex-shrink: 0;
  313. width: 40rpx;
  314. font-size: 30rpx;
  315. color: $font-color-dark;
  316. }
  317. .input {
  318. flex: 1;
  319. font-size: 30rpx;
  320. color: $font-color-dark;
  321. }
  322. .iconlocation {
  323. font-size: 36rpx;
  324. color: $font-color-light;
  325. }
  326. .buttom {
  327. color: $font-color;
  328. font-size: $font-base;
  329. }
  330. }
  331. }
  332. .add-btn {
  333. &.modified {
  334. color: $base-color;
  335. }
  336. &.up {
  337. background: #5dbc7c;
  338. border-radius: 40px;
  339. color: #fff;
  340. }
  341. &.to {
  342. border: 1px solid rgba(252, 42, 63, 1);
  343. border-radius: 40px;
  344. border-radius: 40px;
  345. color: #fc2a3f;
  346. }
  347. display: flex;
  348. align-items: center;
  349. justify-content: center;
  350. width: 560rpx;
  351. height: 75rpx;
  352. margin: 0 auto;
  353. margin-top: 25rpx;
  354. font-size: $font-lg;
  355. border-radius: 10rpx;
  356. // box-shadow: 1px 2px 5px rgba(219, 63, 96, 0.4);
  357. }
  358. .erwema {
  359. width: 135px;
  360. height: 140px;
  361. background-color: #ffffff;
  362. display: flex;
  363. justify-content: center;
  364. align-items: center;
  365. margin: 0rpx auto;
  366. }
  367. </style>