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

359 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
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-line-2 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;position: relative;">
  76. <textarea :cursor-spacing="120" maxlength="300" :adjust-position="true" type="text" v-model="applyInfo" class="text-left lf-font-32 area-self" placeholder="请输入反馈信息" />
  77. <view class="font-change">{{ dynamicLength() }}/300</view>
  78. </view>
  79. </view>
  80. <view class="cu-form-group">
  81. <view class="grid col-4 grid-square flex-sub">
  82. <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]">
  83. <image :src="img_list[index]" mode="aspectFill"></image>
  84. <view class="cu-tag bg-red" @tap.stop="DelImg(index)" :data-index="index">
  85. <text class='cuIcon-close'></text>
  86. </view>
  87. </view>
  88. <view style="width: 212rpx;height: 212rpx;border-radius: 10rpx;" class="solids" @tap="ChooseImage" v-if="img_list.length<3">
  89. <text class='cuIcon-cameraadd'></text>
  90. </view>
  91. </view>
  92. </view>
  93. <view class="padding-lr-lg" style="margin-top: 80rpx;">
  94. <button class="cu-btn block bg-orange lg round" @tap="subimitApply()">
  95. <text class="cuIcon-loading2 cuIconfont-spin margin-right-xs text-white" v-if="loading"></text>
  96. <text class="text-df text-white">确认申请</text>
  97. </button>
  98. </view>
  99. <view style="height: 100rpx;">
  100. </view>
  101. </skeleton>
  102. </block>
  103. </view>
  104. </template>
  105. <script>
  106. export default {
  107. data() {
  108. return {
  109. skeletonLoading: true,
  110. loading: false,
  111. // 选择的本地图片路径
  112. hostImg: '',
  113. order_id: 1,
  114. applyDetails: {},
  115. applyInfo: '',
  116. imageOnline: '',
  117. is_wx_reduce: true,
  118. img_list: [], // 反馈问题图片
  119. }
  120. },
  121. computed: {
  122. isRight(){
  123. return function(val){
  124. return this.$shared.isRight(val);
  125. }
  126. }
  127. },
  128. onLoad(e) {
  129. this.order_id = e.order_id
  130. if(this.order_id) {
  131. this.getApplyDetails()
  132. }
  133. setTimeout(()=>{
  134. this.skeletonLoading = false
  135. },1000)
  136. },
  137. methods: {
  138. dynamicLength(){
  139. return parseInt(this.applyInfo.length);
  140. },
  141. getApplyDetails() {
  142. this.$http(this.API.API_APPLY_DETAILS, {order_id: this.order_id}).then(res => {
  143. if(res.code == 0) {
  144. this.applyDetails = res.data
  145. this.skeletonLoading = false
  146. }
  147. })
  148. },
  149. checkImgInfo(tempFilePath, suc){
  150. uni.getImageInfo({
  151. src: tempFilePath,
  152. success (res) {
  153. let type = res.type;
  154. console.log('checkImgInfo...', type);
  155. if(type == 'png' || type == 'jpeg' || type == 'jpg'){
  156. suc && suc(true);
  157. } else {
  158. suc && suc(false);
  159. }
  160. },
  161. fail(err) {
  162. suc && suc(false);
  163. }
  164. })
  165. },
  166. subimitApply() {
  167. if(!this.applyInfo) {
  168. this.$msg('请先输入反馈信息!')
  169. return
  170. }
  171. this.upload()
  172. },
  173. // 选择图片
  174. ChooseImage(e) {
  175. let that = this;
  176. uni.chooseImage({
  177. count: 1,
  178. sizeType: ['original'], // 可以指定是原图original还是压缩图compressed ,默认二者都有
  179. sourceType: ['album', 'camera'], // album 从相册选图,camera 使用相机,默认二者都有
  180. success: res => {
  181. that.hostImg = res.tempFilePaths[0];
  182. let tempFile = res.tempFiles.shift();
  183. let tempFilePath = res.tempFilePaths.shift();
  184. that.checkImgInfo(tempFilePath, (res) => {
  185. // 过滤不是图片不是png、jpeg 格式
  186. if(res){
  187. if(tempFile.size > 10000000){
  188. uni.showModal({
  189. title: '',
  190. content: '您选择的图片过大:'+ (tempFile.size / 1024000).toFixed(2) +"M,请点击确定重新上传",
  191. success: res2 => {
  192. if(res2.confirm){
  193. uni.chooseImage({
  194. count: 1,
  195. sizeType: ['compressed'],
  196. sourceType: ['album', 'camera'],
  197. success: (res3) => {
  198. let tempFilePath = res3.tempFilePaths.shift();
  199. that.is_wx_reduce = true;
  200. that.img_list.push(tempFilePath);
  201. }
  202. })
  203. }
  204. }
  205. })
  206. } else{
  207. that.img_list.push(tempFilePath);
  208. }
  209. } else {
  210. uni.showModal({
  211. title: '',
  212. content: '选择的图片须为jpg、jpeg或png格式',
  213. showCancel: false,
  214. confirmColor: '#1697EE'
  215. })
  216. }
  217. });
  218. }
  219. });
  220. },
  221. // 上传图片到服务器
  222. upload(url){
  223. let that = this;
  224. let uploads = [];
  225. // 商品banner图上传
  226. if (that.img_list.length > 0) {
  227. for (let i = 0; i < that.img_list.length; i++) {
  228. let upload_img = new Promise((resolve, reject) => {
  229. that.uploadFile(that.img_list[i], (res) => {
  230. resolve(res);
  231. }, (err) => {
  232. reject(err);
  233. });
  234. })
  235. uploads.push(upload_img);
  236. }
  237. }
  238. if(uploads.length == 0) {
  239. that.realSubmitInfo([]);
  240. return
  241. }
  242. Promise.all(uploads).then((result) => {
  243. console.log('图片上传...', result)
  244. let img_url_list = [];
  245. if(result.length > 0){
  246. img_url_list = JSON.stringify(result);
  247. }
  248. if(img_url_list) {
  249. that.realSubmitInfo(img_url_list);
  250. }
  251. }).catch(err => {
  252. console.log(err)
  253. that.is_publish = false; // 恢复提交按钮
  254. uni.showModal({
  255. title: '',
  256. content: '图片上传失败,请重新提交',
  257. confirmColor: '#1697EE'
  258. })
  259. })
  260. },
  261. // 提交反馈
  262. realSubmitInfo(img_url_list){
  263. let that = this;
  264. let params = {order_id: that.order_id,comment: that.applyInfo,images:img_url_list}
  265. if(img_url_list.length == 0) {
  266. delete params.images;
  267. }
  268. uni.showToast({
  269. title: '请求中',
  270. icon: "loading",
  271. duration: 10000
  272. })
  273. that.$http(that.API.API_SUBMIT_APPLY, params).then(res => {
  274. if(res.code == 0) {
  275. that.$msg('提交成功')
  276. that.img_list = []
  277. that.applyInfo = ''
  278. console.log(that.order_id)
  279. setTimeout(() => {
  280. console.log(that.order_id)
  281. that.$url('/pages/order/apply-details?order_id='+that.order_id,{type:'launch'})
  282. },1000)
  283. }
  284. }).catch(err => {
  285. });
  286. },
  287. // 预览图片
  288. showImg(index) {
  289. this.$u.throttle(() => {
  290. let goods_banner = this.img_list || [];
  291. let banners = goods_banner.map(item => item);
  292. uni.previewImage({
  293. urls: banners,
  294. current: index
  295. })
  296. }, 200);
  297. },
  298. // 删除图片
  299. DelImg(index) {
  300. uni.showModal({
  301. title: '提示',
  302. content: '即将取消上传这张图片,请确认?',
  303. success: e => {
  304. if (!e.confirm) return;
  305. this.img_list.splice(index, 1);
  306. }
  307. });
  308. },
  309. // 点击复制
  310. copy(text) {
  311. uni.setClipboardData({
  312. data: text
  313. });
  314. },
  315. }
  316. }
  317. </script>
  318. <style lang="scss" scoped>
  319. .bref-box {
  320. text-overflow: -o-ellipsis-lastline;
  321. overflow: hidden;
  322. text-overflow: ellipsis;
  323. display: -webkit-box;
  324. -webkit-line-clamp: 2;
  325. -webkit-box-orient: vertical;
  326. }
  327. .area-self {
  328. width: 100%;
  329. padding: 30rpx;
  330. padding-bottom: 36rpx;
  331. color: #333;
  332. border: 1px solid #D0D0D0;
  333. border-radius: 10rpx;
  334. }
  335. .font-change{
  336. position: absolute;
  337. right: 10rpx;
  338. bottom: 10rpx;
  339. width: max-content;
  340. color: #777777;
  341. }
  342. </style>