tongue.vue 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. <template>
  2. <view class="container">
  3. <form @submit="bindSave">
  4. <view class="header">
  5. <view class="title">上传照片</view>
  6. <view class="sub-title">请上传清䀿照片为获得准确的结果,请您在光线充足的环境下测试,时间最好在上午9:00--11:00</view>
  7. </view>
  8. <view class="tui-box-upload">
  9. <tui-upload :value="value" :limit="1" @complete="result" @remove="remove"></tui-upload>
  10. </view>
  11. <view class="tui-btn-box">
  12. <tui-button formType="submit" type="danger" height="88rpx" shape="circle">提交</tui-button>
  13. </view>
  14. </form>
  15. </view>
  16. </template>
  17. <script>
  18. import pay from '@/common/pay.js'
  19. export default {
  20. data() {
  21. return {
  22. imageData: [],
  23. value: [] //初始化图片
  24. }
  25. },
  26. onLoad() {
  27. /*
  28. setTimeout(()=>{
  29. this.value=['/static/images/default_img.png']
  30. },200)
  31. */
  32. },
  33. onShow: function() {
  34. var _this = this;
  35. _this.$request.post('tongue.check').then(res => {
  36. if (res.errno == 0) {
  37. if (res.data.id){
  38. uni.reLaunch({
  39. url: "/pagesA/my/tongue/detail?id=" + res.data.id
  40. });
  41. }
  42. }
  43. });
  44. },
  45. methods: {
  46. result: function(e) {
  47. console.log(e)
  48. this.imageData = e.imgArr;
  49. },
  50. remove: function(e) {
  51. //移除图片
  52. console.log(e)
  53. let index = e.index
  54. },
  55. bindSave: function(e) {
  56. var _this = this;
  57. _this.$request.post('tongue.upload', {
  58. img: this.imageData[0]
  59. }).then(res => {
  60. if (res.errno != 0) {
  61. uni.showToast({
  62. title: res.msg,
  63. icon: 'none'
  64. });
  65. return;
  66. } else {
  67. //console.log(res.data.id);
  68. pay.wxpay('tongue', res.data.price, res.data.id, "/pagesA/my/tongue/detail?id=" + res
  69. .data.id);
  70. }
  71. });
  72. }
  73. },
  74. /**
  75. * 页面相关事件处理函数--监听用户下拉动作
  76. */
  77. onPullDownRefresh: function() {
  78. setTimeout(() => {
  79. uni.stopPullDownRefresh()
  80. }, 200);
  81. },
  82. }
  83. </script>
  84. <style>
  85. page {
  86. background-color: #fff;
  87. }
  88. .container {
  89. padding: 20rpx 0 120rpx 0;
  90. box-sizing: border-box;
  91. }
  92. .header {
  93. padding: 80rpx 90rpx 60rpx 90rpx;
  94. box-sizing: border-box;
  95. }
  96. .title {
  97. font-size: 34rpx;
  98. color: #333;
  99. font-weight: 500;
  100. }
  101. .sub-title {
  102. font-size: 24rpx;
  103. color: #7a7a7a;
  104. padding-top: 18rpx;
  105. }
  106. .tui-box-upload {
  107. padding-left: 50rpx;
  108. box-sizing: border-box;
  109. }
  110. .tui-btn-box {
  111. width: 100%;
  112. padding: 20rpx;
  113. box-sizing: border-box;
  114. }
  115. </style>