时空网前端
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.

370 lines
11 KiB

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