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

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