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

342 lines
10 KiB

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