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

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