ordRetInfo.vue 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208
  1. <template>
  2. <view class="home">
  3. <!-- <view v-if="type == 1" class="putWarp bb dffd">
  4. <view class="putin dfsb">
  5. <text class="fontbase flex1">填写收货状态</text>
  6. <input type="text" v-model="name" placeholder="已到货或未到货" />
  7. </view>
  8. </view> -->
  9. <view class="putWarp dffd">
  10. <!-- <view class="putin dfsb">
  11. <text class="fontbase flex1">申请金额</text>
  12. <text class="priceDan">19.9</text>
  13. </view> -->
  14. <view class="putin spec ">
  15. <text class="fontbase flex1">申请说明</text>
  16. <textarea class="lyCon" maxlength="-1" v-model="content" placeholder="请填写详细的申请说明" />
  17. </view>
  18. <view class="imgWarp dffs">
  19. <view class="pre-box dffs">
  20. <view class="pre-item dffs" v-for="(item, index) in uUpload" :key="index">
  21. <image class="pre-item-image" :src="item.lists" mode="widthFix"></image>
  22. <view class="u-delete-icon dfsb" @tap.stop="deleteItem(item.id)"><u-icon name="close" size="16" color="#ffffff"></u-icon></view>
  23. </view>
  24. </view>
  25. <view @tap="choose" class="imgBox dfsb"><u-icon name="plus" size="30" color="#DEDEDE"></u-icon></view>
  26. </view>
  27. <!-- <view class="imgBox dffs">
  28. <view class="pre-box">
  29. <view class="pre-item dffs" v-for="(item, index) in newsInfo.img" :key="index">
  30. <image @click="preview(newsInfo.img, index)" class="pre-item-image" :src="item" mode="aspectFill"></image>
  31. </view>
  32. </view>
  33. </view> -->
  34. </view>
  35. <u-button color="#ED742F" @click="clickHandle" throttleTime="2000" class="custom-style" text="提交申请"></u-button>
  36. </view>
  37. </template>
  38. <script>
  39. import { pathToBase64 } from '@/common/tool/pathToBase64.js';
  40. export default {
  41. data() {
  42. return {
  43. type: 1,
  44. id: '',
  45. content: '',
  46. uUpload: [] // 组件实例
  47. };
  48. },
  49. onLoad(opt) {
  50. this.type = opt.type || 1;
  51. this.id = opt.id || '';
  52. },
  53. onShow() {},
  54. methods: {
  55. clickHandle() {
  56. if (!this.content) {
  57. return this.$api.toast('请输入原因', 1000);
  58. }
  59. let arr = [];
  60. this.uUpload.forEach(item => {
  61. arr.push(item.id);
  62. });
  63. this.$api
  64. .request('orders/aftersale_order', {
  65. id: this.id,
  66. content: this.content,
  67. img: arr || ''
  68. })
  69. .then(data => {
  70. if (data.code == '200') {
  71. this.$api.toast(data.msg);
  72. setTimeout(res => {
  73. uni.navigateBack({
  74. delta: 1
  75. });
  76. }, 800);
  77. } else {
  78. this.$api.toast(data.msg);
  79. }
  80. })
  81. .catch(function(error) {
  82. this.$api.toast(error);
  83. });
  84. },
  85. deleteItem(id) {
  86. this.uUpload.forEach((item, ind) => {
  87. console.log(item);
  88. if (item.id == id) {
  89. this.uUpload.splice(ind, 1);
  90. }
  91. });
  92. },
  93. choose() {
  94. let that = this;
  95. uni.chooseImage({
  96. count: 1, //默认9
  97. sizeType: ['original', 'compressed'], //可以指定是原图还是压缩图,默认二者都有
  98. success: function(res) {
  99. console.log(res);
  100. var imageSrc = res.tempFilePaths[0];
  101. pathToBase64(imageSrc).then(base64 => {
  102. that.$api
  103. .request('common/doupload', {
  104. imgdata: base64
  105. })
  106. .then(res => {
  107. that.uUpload.push({ lists: res.data.imgurl, id: res.data.img_id });
  108. });
  109. });
  110. }
  111. });
  112. }
  113. }
  114. };
  115. </script>
  116. <style lang="scss">
  117. .home {
  118. padding: 20rpx 0rpx 0;
  119. //yanzhengma
  120. .u-hairline-border[data-v-3bf2dba7]:after {
  121. border: 0;
  122. }
  123. .tips {
  124. padding: 0;
  125. color: $promain;
  126. font-size: 28rpx;
  127. line-height: 40rpx;
  128. height: 40rpx;
  129. }
  130. .putWarp {
  131. background-color: #fff;
  132. padding: 0rpx 32rpx;
  133. align-items: center;
  134. margin-bottom: 20rpx;
  135. .priceDan {
  136. color: #333;
  137. }
  138. .putin {
  139. width: 100%;
  140. padding: 30rpx 0;
  141. input {
  142. text-align: right;
  143. }
  144. }
  145. .spec {
  146. .lyCon {
  147. width: 100%;
  148. height: 80rpx;
  149. padding: 24rpx 0;
  150. font-size: 24rpx;
  151. }
  152. }
  153. }
  154. .custom-style {
  155. background-color: #ed742e;
  156. color: #fff;
  157. width: 690rpx;
  158. margin-top: 200rpx;
  159. border-radius: 11rpx;
  160. }
  161. .imgWarp {
  162. width: 100%;
  163. margin-top: 30rpx;
  164. flex-wrap: wrap;
  165. .imgBox {
  166. background-color: #fff;
  167. border: 1px solid #f3f3f3;
  168. justify-content: center;
  169. width: 120rpx;
  170. height: 120rpx;
  171. }
  172. .pre-box {
  173. flex-wrap: wrap;
  174. }
  175. .pre-item {
  176. margin-right: 60rpx;
  177. margin-bottom: 20rpx;
  178. width: 120rpx;
  179. position: relative;
  180. flex-wrap: wrap;
  181. &:nth-of-type(4n) {
  182. margin-right: 0;
  183. }
  184. }
  185. .pre-item-image {
  186. width: 120rpx;
  187. height: auto;
  188. }
  189. .u-delete-icon {
  190. position: absolute;
  191. top: -10rpx;
  192. right: -10rpx;
  193. z-index: 10;
  194. background-color: #333;
  195. border-radius: 100rpx;
  196. width: 30rpx;
  197. height: 30rpx;
  198. }
  199. }
  200. }
  201. </style>