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

354 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
  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" style="display: flex;align-items: flex-end;">
  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">{{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. orderId: 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.orderId = e.orderId
  138. if(this.orderId) {
  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.orderId}).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. Promise.all(uploads).then((result) => {
  249. console.log('图片上传...', result)
  250. let img_url_list = [];
  251. if(result.length > 0){
  252. img_url_list = JSON.stringify(result);
  253. }
  254. if(img_url_list) {
  255. that.realSubmitInfo(img_url_list);
  256. }
  257. }).catch(err => {
  258. console.log(err)
  259. that.is_publish = false; // 恢复提交按钮
  260. uni.showModal({
  261. title: '',
  262. content: '图片上传失败,请重新提交',
  263. confirmColor: '#1697EE'
  264. })
  265. })
  266. },
  267. // 提交反馈
  268. realSubmitInfo(img_url_list){
  269. let that = this;
  270. uni.showToast({
  271. title: '请求中',
  272. icon: "loading",
  273. duration: 10000
  274. })
  275. that.$http(that.API.API_SUBMIT_APPLY, {order_id: that.orderId,comment: that.applyInfo,images:img_url_list}).then(res => {
  276. if(res.code == 0) {
  277. that.$msg('提交成功')
  278. that.img_list = []
  279. that.applyInfo = ''
  280. setTimeout(() => {
  281. that.$routerGo('/pages/order/apply-details?orderId='+that.orderId)
  282. },1000)
  283. }
  284. }).catch(err => {
  285. });
  286. },
  287. // 预览图片
  288. showImg(image) {
  289. // let image = this.img_list[index];
  290. uni.previewImage({
  291. urls: [image],
  292. });
  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>