dhtj.vue 7.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  1. <template>
  2. <view>
  3. <view style="padding: 30rpx;">
  4. <view style="font-size: 28rpx;color: #fff;border-bottom: #fff solid 1rpx;line-height: 300%;">兑换商品:{{data.cpmc}}</view>
  5. <view style="font-size: 28rpx;color: #fff;border-bottom: #fff solid 1rpx;line-height: 300%;">兑换价格:{{data.price}}</view>
  6. <view style="font-size: 28rpx;color: #fff;line-height: 200%;">付款方式:
  7. <text v-if="data.lzc==1">拍拍宝付款</text>
  8. </view>
  9. <view v-for="(item, index) in goodlist" :key="index" style="margin-bottom:20rpx;" v-if="data.lzc==0">
  10. <view class="b1" style="border-radius: 10rpx 10rpx 0 0;font-size: 30rpx;">
  11. <text style="float: left;color:#f1a325;">{{item.type}}</text>
  12. </view>
  13. <view style="background: #fff;padding: 20rpx;font-size: 30rpx;line-height: 200%;">
  14. <view v-if="item.type=='银行卡支付'">开户行:{{item.khh}}<text class="copy" @click="copy(item.khh)">复制</text></view>
  15. <view>账户名称:{{item.zhmc}}<text class="copy" @click="copy(item.zhmc)">复制</text></view>
  16. <view v-if="item.type=='USDT支付'">手机账号:{{item.sjh}}<text class="copy" @click="copy(item.sjh)">复制</text></view>
  17. <view v-if="item.type=='银行卡支付' || item.type=='支付宝支付'">账号:{{item.skzh}}<text class="copy" @click="copy(item.skzh)">复制</text></view>
  18. <view v-if="item.type=='银行卡支付'">开户行地址:{{item.fhh}}<text class="copy" @click="copy(item.fhh)">复制</text></view>
  19. <view v-if="item.type=='微信支付'">收款码:
  20. <view>
  21. <image :src="item.skm" style="width: 150rpx;height: 150rpx;" @click="viewimg(item.skm)">
  22. </view>
  23. </view>
  24. </view>
  25. </view>
  26. <view class="tit">收件人</view>
  27. <input class="srk" placeholder="请输入收件人" v-model="data.xm" />
  28. <view class="tit">联系电话</view>
  29. <input class="srk" placeholder="请输入联系电话" v-model="data.sjh" />
  30. <view class="tit">收件地址</view>
  31. <input class="srk" placeholder="请输入收件地址" v-model="data.dz" />
  32. <view class="tit" v-if="data.lzc==0">付款凭证:</view>
  33. <view v-if="data.lzc==0">
  34. <image v-if="data.dkpz" style="width:150rpx;height: 150rpx;" referrerpolicy="no-referrer"
  35. :src="data.dkpz"
  36. @click="viewimg(data.dkpz)"
  37. />
  38. <image v-else style="width: 150rpx;height: 150rpx;" referrerpolicy="no-referrer" src="/static/xj.png" @click="shangchuanpingzheng()"/>
  39. </view>
  40. <button type="warn" style="margin-top: 40rpx;" @click="add">确认兑换</button>
  41. </view>
  42. </view>
  43. </template>
  44. <script>
  45. export default {
  46. data() {
  47. return {
  48. data:{
  49. dkpz:'',
  50. cpmc:'',
  51. id:'',
  52. price:'',
  53. lx:'',
  54. xm:'',
  55. sjh:'',
  56. dz:'',
  57. uid:0,
  58. lzc:0
  59. },
  60. skr:'',
  61. goodlist:[],
  62. userinfo:[]
  63. }
  64. },
  65. methods: {
  66. add() {
  67. var data = this.data;
  68. if(!data.xm || !data.sjh || !data.dz){
  69. uni.showToast({
  70. title:"请输入完整信息后兑换",
  71. icon:"none"
  72. })
  73. return;
  74. }
  75. if(!data.dkpz && data.lzc==0){
  76. uni.showToast({
  77. title:"请输入完整信息后兑换",
  78. icon:"none"
  79. })
  80. return;
  81. }
  82. this.$api
  83. .MhGetModel(data, 'shop/duihuan')
  84. .then(res => {
  85. if(res.data.code==1){
  86. uni.redirectTo({
  87. url: 'cg?tel='+this.skr
  88. });
  89. }else{
  90. uni.showModal({
  91. title: '提示',
  92. content: res.data.msg,
  93. showCancel:false,
  94. success: function (res) {
  95. if (res.confirm) {
  96. } else if (res.cancel) {
  97. console.log('用户点击取消');
  98. }
  99. }
  100. });
  101. }
  102. })
  103. .catch(err => {
  104. // console.log('request fail', JSON.stringify(err));
  105. });
  106. // console.log(333)
  107. },
  108. shangchuanpingzheng() {
  109. var that = this;
  110. uni.chooseImage({
  111. count: 1, //默认9
  112. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  113. sourceType: ['album'], //从相册选择
  114. success: function(res) {
  115. // console.log(JSON.stringify(res.tempFilePaths));
  116. uni.uploadFile({
  117. url: that.$api.getUploadurl2,
  118. filePath: res.tempFilePaths[0],
  119. name: 'file',
  120. success: function(res) {
  121. var path = res.data;
  122. path = JSON.parse(path).data.url;
  123. that.data.dkpz=path;
  124. //console.log(that.data)
  125. //that.saveShangchuanpingzheng(item, path);
  126. }
  127. });
  128. }
  129. });
  130. },
  131. copy(text){
  132. uni.setClipboardData({
  133. data:text,
  134. success: function () {
  135. console.log('success');
  136. }
  137. });
  138. },
  139. viewimg(path) {
  140. uni.previewImage({
  141. urls: [path],
  142. longPressActions: {
  143. itemList: ['发送给朋友', '保存图片', '收藏'],
  144. success: function(data) {
  145. // console.log('选中了第' + (data.tapIndex + 1) + '个按钮,第' + (data.index + 1) + '张图片');
  146. },
  147. fail: function(err) {
  148. // console.log(err.errMsg);
  149. }
  150. }
  151. });
  152. },
  153. sklist(){
  154. var data = this.data;
  155. this.$api
  156. .MhGetModel(data, 'shop/sklist')
  157. .then(res => {
  158. this.goodlist = res.data.data;
  159. this.skr=res.data.skr;
  160. if(res.data.ppb==1){
  161. console.log(22)
  162. this.data.lzc=-1;
  163. }
  164. })
  165. .catch(err => {
  166. // console.log('request fail', JSON.stringify(err));
  167. });
  168. },
  169. skm(skm){
  170. uni.navigateTo({
  171. url: '/pages/shoukuan/cktp?src='+skm
  172. });
  173. },
  174. getMhUserinfo() {
  175. var data = new Object();
  176. //data.uid = this.data.id;
  177. data.uid = this.userinfo.id;
  178. data.src='my';
  179. this.$api
  180. .MhPostModel(data, 'user/info')
  181. .then(res => {
  182. if (res.data.code != 1) {
  183. uni.showModal({
  184. title: '提示',
  185. content: '账号异常!',
  186. showCancel:false,
  187. success: function (res) {
  188. if (res.confirm) {
  189. uni.navigateTo({
  190. url: '/pages/lanhu_login/index'
  191. });
  192. } else if (res.cancel) {
  193. console.log('用户点击取消');
  194. }
  195. }
  196. });
  197. } else {
  198. this.userinfo = res.data.data;
  199. this.data.lzc=this.userinfo.lzc1
  200. console.log(this.data.lzc)
  201. this.$api.setUserinfo(res.data.data);
  202. }
  203. })
  204. .catch(err => {
  205. // console.log('request fail', JSON.stringify(err));
  206. });
  207. }
  208. },
  209. onLoad(o) {
  210. this.data.cpmc = o.cpmc;
  211. this.data.price = o.price;
  212. this.data.id = o.id;
  213. this.data.lx = o.lx;
  214. var user = this.$api.getUserinfo();
  215. if (user) {
  216. this.userinfo = user;
  217. this.data.uid = user.id;
  218. this.getMhUserinfo();
  219. } else {
  220. this.userinfo = null;
  221. uni.showToast({
  222. title:"请先登录",
  223. icon:"none"
  224. })
  225. setTimeout(function(){
  226. uni.navigateTo({
  227. url:"/pages/lanhu_login/index"
  228. })
  229. },1000)
  230. }
  231. this.sklist()
  232. }
  233. }
  234. </script>
  235. <style>
  236. page{padding: 15rpx;background: #98a737;background-attachment: fixed !important;
  237. background-repeat: no-repeat !important;}
  238. .b1 {
  239. overflow: hidden;
  240. padding: 10rpx 15rpx;
  241. color: #f1a325;
  242. background: #fff0d5;
  243. border: 1rpx solid #ffdcbc;
  244. }
  245. .copy{background: #98a737;font-size: 26rpx;color: #fff;padding: 5rpx 10rpx;margin-left: 30rpx;border-radius: 10rpx;}
  246. .srk {
  247. color: #000;
  248. height: 60rpx;
  249. line-height: 60rpx;
  250. background: #fff;
  251. border-radius: 10rpx;
  252. padding-left: 20rpx;
  253. font-size: 30rpx;
  254. }
  255. .tit {
  256. font-size: 28rpx;color: #fff;line-height: 300%;
  257. }
  258. </style>