时空网前端
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

348 lines
10 KiB

5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
  1. <template>
  2. <view>
  3. <block v-if="isRight(applyDetails)">
  4. <!-- 商品信息 -->
  5. <view class="bg-white">
  6. <skeleton :loading="skeletonLoading" :row="2" :showAvatar="false" :showTitle="true">
  7. <view class="flex justify-between align-start" style="padding: 32rpx 32rpx 30rpx 32rpx;">
  8. <image :src="applyDetails.order.goods.cover" mode="aspectFill" style="width: 240rpx; height: 240rpx;border-radius: 10rpx;"></image>
  9. <view class="flex-sub padding-left-sm">
  10. <view class="bref-box text-black1 lf-font-32 lf-font-bold" style="height: 88rpx;line-height: 44rpx;" v-if="applyDetails.order.goods.name">
  11. {{applyDetails.order.goods.name}}
  12. </view>
  13. <text class="block text-gray lf-font-28" style="margin-top: 20rpx;line-height: 40rpx;">数量 <text class="margin-left margin-right-xs text-gray">x</text>{{applyDetails.order.number}}</text>
  14. <view class="flex justify-between" style="margin-top: 44rpx;">
  15. <lf-price :price="applyDetails.order.selling_price" />
  16. </view>
  17. </view>
  18. </view>
  19. </skeleton>
  20. </view>
  21. <self-line/>
  22. <skeleton :loading="skeletonLoading" :row="3" :showAvatar="false" :showTitle="true">
  23. <view class="bg-white">
  24. <view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
  25. <text class="text-gray lf-font-32">订单金额</text>
  26. <view class="text-price1 lf-font-32 text-black">
  27. {{applyDetails.order.amount}}
  28. </view>
  29. </view>
  30. <view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
  31. <text class="text-gray lf-font-32">扣费率</text>
  32. <view>
  33. <text class="lf-font-32 text-black">{{applyDetails.order.refund_rate}}%</text>
  34. </view>
  35. </view>
  36. <view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
  37. <text class="text-gray lf-font-32">扣费金额</text>
  38. <view class="text-price1 lf-font-32 text-black">
  39. {{applyDetails.order.refund_rate_amount}}
  40. </view>
  41. </view>
  42. </view>
  43. </skeleton>
  44. <self-line/>
  45. <!-- 表单 -->
  46. <skeleton :loading="skeletonLoading" :row="3" :showAvatar="false" :showTitle="true">
  47. <view class="bg-white">
  48. <view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
  49. <text class="text-gray lf-font-32">可退金额</text>
  50. <view class="text-price1 lf-font-32 text-black">
  51. {{applyDetails.order.refund_amount}}
  52. </view>
  53. </view>
  54. <view class="cu-bar padding-lr solid-bottom flex justify-between align-center text-center">
  55. <text class="text-gray lf-font-32">订单编号</text>
  56. <view>
  57. <text class="margin-right lf-font-32 text-black">{{applyDetails.order.order_sn}}</text>
  58. <text class="text-orange lf-font-32" @tap="copy(applyDetails.order.order_sn)">复制</text>
  59. </view>
  60. </view>
  61. <view class="padding-top padding-lr bg-white" v-if="applyDetails.agreement.article_id">
  62. <view class="cu-self menu">
  63. <view class="text-gray lf-font-28">
  64. 由于产品的特殊性在申请的过程中供应商会向您收取部分费用如有疑问可参考产品的<text class="text-orange" @tap="$routerGo('/pages/agreement/agreement?id='+applyDetails.agreement.article_id)">{{applyDetails.agreement.title}}</text>或咨询客服
  65. </view>
  66. </view>
  67. </view>
  68. </view>
  69. </skeleton>
  70. <skeleton :loading="skeletonLoading" :row="6" :showAvatar="false" :showTitle="true">
  71. <view class="bg-white" style="padding: 40rpx 32rpx 30rpx 32rpx;">
  72. <view class="cu-self menu">
  73. <view class="lf-font-32 text-black1">退款说明</view>
  74. </view>
  75. <view class="cu-self menu" style="margin-top: 30rpx;">
  76. <textarea :cursor-spacing="120" :adjust-position="true" type="text" v-model="applyInfo" class="text-left lf-font-32 area-self" placeholder="请输入反馈信息" />
  77. </view>
  78. </view>
  79. <view class="cu-form-group">
  80. <view class="grid col-4 grid-square flex-sub">
  81. <view style="width: 212rpx;height: 212rpx;border-radius: 10rpx;" class="bg-img" v-for="(item,index) in img_list" :key="index" @tap="showImg(index)" :data-url="img_list[index]">
  82. <image :src="img_list[index]" mode="aspectFill"></image>
  83. <view class="cu-tag bg-red" @tap.stop="DelImg(index)" :data-index="index">
  84. <text class='cuIcon-close'></text>
  85. </view>
  86. </view>
  87. <view style="width: 212rpx;height: 212rpx;border-radius: 10rpx;" class="solids" @tap="ChooseImage" v-if="img_list.length<3">
  88. <text class='cuIcon-cameraadd'></text>
  89. </view>
  90. </view>
  91. </view>
  92. <view class="padding-lr-lg" style="margin-top: 80rpx;">
  93. <button class="cu-btn block bg-orange lg round" @tap="subimitApply()">
  94. <text class="cuIcon-loading2 cuIconfont-spin margin-right-xs text-white" v-if="loading"></text>
  95. <text class="text-df text-white">确认申请</text>
  96. </button>
  97. </view>
  98. <view style="height: 100rpx;">
  99. </view>
  100. </skeleton>
  101. </block>
  102. </view>
  103. </template>
  104. <script>
  105. export default {
  106. data() {
  107. return {
  108. skeletonLoading: true,
  109. loading: false,
  110. // 选择的本地图片路径
  111. hostImg: '',
  112. order_id: 1,
  113. applyDetails: {},
  114. applyInfo: '',
  115. imageOnline: '',
  116. is_wx_reduce: true,
  117. img_list: [], // 反馈问题图片
  118. }
  119. },
  120. computed: {
  121. isRight(){
  122. return function(val){
  123. return this.$shared.isRight(val);
  124. }
  125. }
  126. },
  127. onLoad(e) {
  128. this.order_id = e.order_id
  129. if(this.order_id) {
  130. this.getApplyDetails()
  131. }
  132. setTimeout(()=>{
  133. this.skeletonLoading = false
  134. },1000)
  135. },
  136. methods: {
  137. getApplyDetails() {
  138. this.$http(this.API.API_APPLY_DETAILS, {order_id: this.order_id}).then(res => {
  139. if(res.code == 0) {
  140. this.applyDetails = res.data
  141. this.skeletonLoading = false
  142. }
  143. })
  144. },
  145. checkImgInfo(tempFilePath, suc){
  146. uni.getImageInfo({
  147. src: tempFilePath,
  148. success (res) {
  149. let type = res.type;
  150. console.log('checkImgInfo...', type);
  151. if(type == 'png' || type == 'jpeg' || type == 'jpg'){
  152. suc && suc(true);
  153. } else {
  154. suc && suc(false);
  155. }
  156. },
  157. fail(err) {
  158. suc && suc(false);
  159. }
  160. })
  161. },
  162. subimitApply() {
  163. if(!this.applyInfo) {
  164. this.$msg('请先输入反馈信息!')
  165. return
  166. }
  167. this.upload()
  168. },
  169. // 选择图片
  170. ChooseImage(e) {
  171. let that = this;
  172. uni.chooseImage({
  173. count: 1,
  174. sizeType: ['original'], // 可以指定是原图original还是压缩图compressed ,默认二者都有
  175. sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
  176. success: res => {
  177. that.hostImg = res.tempFilePaths[0];
  178. let tempFile = res.tempFiles.shift();
  179. let tempFilePath = res.tempFilePaths.shift();
  180. that.checkImgInfo(tempFilePath, (res) => {
  181. // 过滤不是图片不是png、jpeg 格式
  182. if(res){
  183. if(tempFile.size > 10000000){
  184. uni.showModal({
  185. title: '',
  186. content: '您选择的图片过大:'+ (tempFile.size / 1024000).toFixed(2) +"M,请点击确定重新上传",
  187. success: res2 => {
  188. if(res2.confirm){
  189. uni.chooseImage({
  190. count: 1,
  191. sizeType: ['compressed'],
  192. sourceType: ['album', 'camera'],
  193. success: (res3) => {
  194. let tempFilePath = res3.tempFilePaths.shift();
  195. that.is_wx_reduce = true;
  196. that.img_list.push(tempFilePath);
  197. }
  198. })
  199. }
  200. }
  201. })
  202. } else{
  203. that.img_list.push(tempFilePath);
  204. }
  205. } else {
  206. uni.showModal({
  207. title: '',
  208. content: '选择的图片须为jpg、jpeg或png格式',
  209. showCancel: false,
  210. confirmColor: '#1697EE'
  211. })
  212. }
  213. });
  214. }
  215. });
  216. },
  217. // 上传图片到服务器
  218. upload(url){
  219. let that = this;
  220. let uploads = [];
  221. // 商品banner图上传
  222. if (that.img_list.length > 0) {
  223. for (let i = 0; i < that.img_list.length; i++) {
  224. let upload_img = new Promise((resolve, reject) => {
  225. that.uploadFile(that.img_list[i], (res) => {
  226. resolve(res);
  227. }, (err) => {
  228. reject(err);
  229. });
  230. })
  231. uploads.push(upload_img);
  232. }
  233. }
  234. if(uploads.length == 0) {
  235. that.realSubmitInfo([]);
  236. return
  237. }
  238. Promise.all(uploads).then((result) => {
  239. console.log('图片上传...', result)
  240. let img_url_list = [];
  241. if(result.length > 0){
  242. img_url_list = JSON.stringify(result);
  243. }
  244. if(img_url_list) {
  245. that.realSubmitInfo(img_url_list);
  246. }
  247. }).catch(err => {
  248. console.log(err)
  249. that.is_publish = false; // 恢复提交按钮
  250. uni.showModal({
  251. title: '',
  252. content: '图片上传失败,请重新提交',
  253. confirmColor: '#1697EE'
  254. })
  255. })
  256. },
  257. // 提交反馈
  258. realSubmitInfo(img_url_list){
  259. let that = this;
  260. let params = {order_id: that.order_id,comment: that.applyInfo,images:img_url_list}
  261. if(img_url_list.length == 0) {
  262. delete params.images;
  263. }
  264. uni.showToast({
  265. title: '请求中',
  266. icon: "loading",
  267. duration: 10000
  268. })
  269. that.$http(that.API.API_SUBMIT_APPLY, params).then(res => {
  270. if(res.code == 0) {
  271. that.$msg('提交成功')
  272. that.img_list = []
  273. that.applyInfo = ''
  274. console.log(that.order_id)
  275. setTimeout(() => {
  276. console.log(that.order_id)
  277. that.$url('/pages/order/apply-details?order_id='+that.order_id,{type:'launch'})
  278. },1000)
  279. }
  280. }).catch(err => {
  281. });
  282. },
  283. // 预览图片
  284. showImg(index) {
  285. this.$u.throttle(() => {
  286. let goods_banner = this.img_list || [];
  287. let banners = goods_banner.map(item => item);
  288. uni.previewImage({
  289. urls: banners,
  290. current: index
  291. })
  292. }, 200);
  293. },
  294. // 删除图片
  295. DelImg(index) {
  296. uni.showModal({
  297. title: '提示',
  298. content: '即将取消上传这张图片,请确认?',
  299. success: e => {
  300. if (!e.confirm) return;
  301. this.img_list.splice(index, 1);
  302. }
  303. });
  304. },
  305. // 点击复制
  306. copy(text) {
  307. uni.setClipboardData({
  308. data: text
  309. });
  310. },
  311. }
  312. }
  313. </script>
  314. <style lang="scss" scoped>
  315. .bref-box {
  316. text-overflow: -o-ellipsis-lastline;
  317. overflow: hidden;
  318. text-overflow: ellipsis;
  319. display: -webkit-box;
  320. -webkit-line-clamp: 2;
  321. -webkit-box-orient: vertical;
  322. }
  323. .area-self {
  324. width: 100%;
  325. padding: 30rpx 0 0 30rpx;
  326. color: #999999;
  327. border: 1px solid #D0D0D0;
  328. border-radius: 10rpx;
  329. }
  330. </style>