user-orderaftersale-detail.vue 36 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754
  1. <template>
  2. <view>
  3. <view v-if="order_data != null" class="padding-horizontal-main padding-top">
  4. <!-- 商品 -->
  5. <view class="goods padding-main border-radius-main bg-white spacing-mb">
  6. <view class="goods-item oh">
  7. <navigator :url="order_data.items.goods_url" hover-class="none">
  8. <image class="goods-image fl radius" :src="order_data.items.images" mode="aspectFill"></image>
  9. <view class="goods-base">
  10. <view class="multi-text">{{order_data.items.title}}</view>
  11. <view v-if="order_data.items.spec != null" class="margin-top-sm">
  12. <block v-for="(sv, si) in order_data.items.spec" :key="si">
  13. <text v-if="si > 0" class="cr-grey padding-left-xs padding-right-xs">;</text>
  14. <text class="cr-gray">{{sv.value}}</text>
  15. </block>
  16. </view>
  17. <view class="margin-top-sm">
  18. <text class="fw-b">{{order_data.currency_data.currency_symbol}}{{order_data.items.price}}</text>
  19. <text class="margin-left-sm">x{{order_data.items.buy_number}}</text>
  20. </view>
  21. </view>
  22. </navigator>
  23. </view>
  24. </view>
  25. <!-- 客服信息 -->
  26. <view v-if="(plugins_intellectstools_data || null) != null" class="bg-white padding-main border-radius-main spacing-mb">
  27. <view v-if="(plugins_intellectstools_data.service_msg || null) != null" class="cr-red margin-bottom">{{plugins_intellectstools_data.service_msg}}</view>
  28. <button type="default" size="mini" class="bg-main br-main cr-white text-size-sm padding-left-xxxl padding-right-xxxl round" @tap="plugins_intellectstools_service_event">
  29. <view class="dis-inline-block va-m margin-right-sm lh-0">
  30. <uni-icons type="chatbubble" size="34rpx" color="#fff"></uni-icons>
  31. </view>
  32. <text>联系客服</text>
  33. </button>
  34. <view v-if="plugins_intellectstools_service_status" class="plugins-intellectstools-service pa border-radius-main oh bg-white br">
  35. <view v-if="(plugins_intellectstools_data.chat || null) != null" class="item padding-main br-t single-text">
  36. <text class="va-m">客服:</text>
  37. <view class="dis-inline-block chat-info cp" @tap="chat_event">
  38. <image class="dis-inline-block va-m" :src="plugins_intellectstools_data.chat.icon" mode="scaleToFill"></image>
  39. <text class="margin-left-sm va-m cr-blue" :data-value="plugins_intellectstools_data.chat.chat_url">{{plugins_intellectstools_data.chat.name}}</text>
  40. </view>
  41. </view>
  42. <view v-if="(plugins_intellectstools_data.service_qq || null) != null" class="item padding-main br-t single-text">
  43. <text>Q Q:</text>
  44. <text class="cp" @tap="text_copy_event" :data-value="plugins_intellectstools_data.service_qq">{{plugins_intellectstools_data.service_qq}}</text>
  45. </view>
  46. <view v-if="(plugins_intellectstools_data.service_tel || null) != null" class="item padding-main br-t single-text">
  47. <text>电话:</text>
  48. <text class="cp" @tap="tel_event" :data-value="plugins_intellectstools_data.service_tel">{{plugins_intellectstools_data.service_tel}}</text>
  49. </view>
  50. <view v-if="(plugins_intellectstools_data.service_weixin || null) != null || (plugins_intellectstools_data.service_line || null) != null" class="oh qrcode tc br-t">
  51. <view v-if="(plugins_intellectstools_data.service_weixin || null) != null" class="item padding-bottom-lg dis-inline-block">
  52. <image class="radius cp" :src="plugins_intellectstools_data.service_weixin" mode="scaleToFill" @tap="image_show_event" :data-value="plugins_intellectstools_data.service_weixin"></image>
  53. <view>长按微信咨询</view>
  54. </view>
  55. <view v-if="(plugins_intellectstools_data.service_line || null) != null" class="item padding-bottom-lg dis-inline-block">
  56. <image class="radius cp" :src="plugins_intellectstools_data.service_line" mode="scaleToFill" @tap="image_show_event" :data-value="plugins_intellectstools_data.service_line"></image>
  57. <view>长按line咨询</view>
  58. </view>
  59. </view>
  60. </view>
  61. </view>
  62. <!-- 基础信息 -->
  63. <view v-if="new_aftersale_data != null">
  64. <!-- 提示/退货 -->
  65. <view v-if="new_aftersale_data.status <= 2" class="msg-tips padding-main border-radius-main spacing-mb">
  66. <text class="msg-text">{{new_aftersale_data.tips_msg}}</text>
  67. <text class="msg-a" @tap="show_aftersale_event">查看 >></text>
  68. <view v-if="new_aftersale_data.status == 1 && new_aftersale_data.type == 1 && return_goods_address != null" class="margin-top-sm oh">
  69. <button class="bg-green cr-white round dis-block fl" type="default" size="mini" @tap="delivery_submit_event">立即退货</button>
  70. </view>
  71. </view>
  72. <!-- 退货地址 -->
  73. <view v-if="new_aftersale_data.status == 1 && new_aftersale_data.type == 1 && return_goods_address != null" class="return-address msg-tips msg-tips-warning padding-main border-radius-main spacing-mb">
  74. <text class="cr-base fw-b">退货地址:</text>
  75. <text class="cr-blue">{{return_goods_address}}</text>
  76. </view>
  77. <!-- 提示 -->
  78. <view v-if="new_aftersale_data.status >= 3" :class="'msg-tips padding-main border-radius-main spacing-mb ' + (new_aftersale_data.status == 3 ? 'msg-tips-success' : (new_aftersale_data.status == 4 ? 'msg-tips-danger' : 'msg-tips-warning'))">
  79. <text class="msg-text">{{new_aftersale_data.tips_msg}}</text>
  80. <text class="msg-a margin-left-sm" @tap="show_aftersale_event">查看 >></text>
  81. </view>
  82. <!-- 详情 -->
  83. <view v-if="new_aftersale_data.status != 5">
  84. <!-- 申请信息 -->
  85. <view class="panel-item padding-main border-radius-main bg-white spacing-mb">
  86. <view class="br-b padding-bottom-main fw-b text-size">申请信息</view>
  87. <view class="panel-content oh">
  88. <view v-for="(item, index) in panel_base_data_list" :key="index" class="item br-b oh padding-vertical-main">
  89. <view class="title fl padding-right-main cr-gray">{{item.name}}</view>
  90. <view class="content fl br-l padding-left-main">{{new_aftersale_data[item.field] || ''}}</view>
  91. </view>
  92. </view>
  93. </view>
  94. <!-- 快递信息 -->
  95. <view v-if="new_aftersale_data.status > 1 && new_aftersale_data.type == 1" class="panel-item padding-main border-radius-main bg-white spacing-mb">
  96. <view class="br-b padding-bottom-main fw-b text-size">快递信息</view>
  97. <view class="panel-content oh">
  98. <view v-for="(item, index) in panel_express_data_list" :key="index" class="item br-b oh padding-vertical-main">
  99. <view class="title fl padding-right-main cr-gray">{{item.name}}</view>
  100. <view class="content fl br-l padding-left-main">{{new_aftersale_data[item.field] || ''}}</view>
  101. </view>
  102. </view>
  103. </view>
  104. <!-- 凭证 -->
  105. <view v-if="(new_aftersale_data.images || null) != null && new_aftersale_data.images.length > 0" class="panel-item padding-main border-radius-main bg-white spacing-mb">
  106. <view class="br-b padding-bottom-main fw-b text-size">凭证</view>
  107. <view class="panel-content-images oh">
  108. <view v-for="(item, index) in new_aftersale_data.images" :key="index" class="fl item padding-sm">
  109. <image :src="item" mode="aspectFill" @tap="images_view_event" :data-index="index" class="dis-block radius"></image>
  110. </view>
  111. </view>
  112. </view>
  113. </view>
  114. </view>
  115. <!-- 没有售后数据/售后数据为已取消则可以重新申请售后 -->
  116. <view v-if="new_aftersale_data == null || new_aftersale_data.status == 5">
  117. <!-- 类型选择 -->
  118. <view v-if="aftersale_type_list.length > 0" class="choose-type padding-main border-radius-main bg-white oh spacing-mb">
  119. <block v-for="(item, index) in aftersale_type_list" :key="index">
  120. <view :class="'choose-item radius padding-main br ' + (index == 0 ? 'fl' : 'fr') + ' ' + (form_type == item.value ? 'br-main' : '')" :data-value="item.value" @tap="form_type_event">
  121. <view class="fw-b margin-bottom-xs">{{item.name}}</view>
  122. <view class="cr-grey">{{item.desc}}</view>
  123. </view>
  124. </block>
  125. </view>
  126. <!-- 表单 -->
  127. <view v-if="form_type != null" class="form-container oh spacing-mb">
  128. <view class="form-gorup">
  129. <view class="form-gorup-title">退款原因<text class="form-group-tips-must">必选</text></view>
  130. <picker @change="form_reason_event" :value="form_reason_index" :range="reason_data_list">
  131. <view :class="'picker ' + (form_reason_index == null ? 'cr-grey' : 'cr-base') + ' arrow-right'">
  132. {{form_reason_index == null ? '请选择原因' : reason_data_list[form_reason_index]}}
  133. </view>
  134. </picker>
  135. </view>
  136. <view v-if="form_type == 1" class="form-gorup">
  137. <view class="form-gorup-title">商品件数<text class="form-group-tips">数量不能大于{{returned_data.returned_quantity}}</text></view>
  138. <slider @change="form_number_event" min="0" :max="returned_data.returned_quantity" step="1" :value="returned_data.returned_quantity" show-value></slider>
  139. </view>
  140. <view class="form-gorup">
  141. <view class="form-gorup-title">退款金额<text class="form-group-tips">不能大于{{returned_data.refund_price}}元</text></view>
  142. <input type="digit" @input="form_price_event" placeholder-class="cr-grey" class="cr-base" placeholder="请输入退款金额" :value="form_price">
  143. </view>
  144. <view class="form-gorup">
  145. <view class="form-gorup-title">退款说明</view>
  146. <textarea @input="form_msg_event" placeholder-class="cr-grey" class="cr-base" placeholder="退款说明最多200个字符" maxlength="200" :auto-height="true" :value="form_msg"></textarea>
  147. </view>
  148. <view class="form-gorup form-container-upload oh">
  149. <view class="form-gorup-title">上传凭证<text class="form-group-tips">最多上传3张图片</text></view>
  150. <view class="oh">
  151. <view class="form-upload-data fl">
  152. <block v-if="form_images_list.length > 0">
  153. <view v-for="(item, index) in form_images_list" :key="index" class="item fl">
  154. <text class="delete-icon" @tap="upload_delete_event" :data-index="index">x</text>
  155. <image :src="item" @tap="upload_show_event" :data-index="index" mode="aspectFill"></image>
  156. </view>
  157. </block>
  158. </view>
  159. <image v-if="(form_images_list[index] || null) == null || form_images_list.length < 3" class="upload-icon" :src="common_static_url+'upload-icon.png'" mode="aspectFill" @tap="file_upload_event"></image>
  160. </view>
  161. </view>
  162. <view class="form-gorup form-gorup-submit">
  163. <button class="bg-main br-main cr-white round text-size" type="default" @tap="form_submit_event" hover-class="none" :disabled="form_button_disabled">提交</button>
  164. </view>
  165. </view>
  166. </view>
  167. </view>
  168. <view v-else>
  169. <!-- 提示信息 -->
  170. <component-no-data :propStatus="data_list_loding_status" :propMsg="data_list_loding_msg"></component-no-data>
  171. </view>
  172. <block v-if="new_aftersale_data != null && new_aftersale_data.status != 5">
  173. <!-- 结尾 -->
  174. <component-bottom-line :propStatus="data_bottom_line_status"></component-bottom-line>
  175. </block>
  176. <!-- 退货弹层 -->
  177. <component-popup :propShow="popup_delivery_status" propPosition="bottom" @onclose="popup_delivery_close_event">
  178. <view class="delivery-popup bg-base padding-horizontal-main padding-top-main">
  179. <view class="fr oh">
  180. <view class="fr" @tap.stop="popup_delivery_close_event">
  181. <icon type="clear" size="20"></icon>
  182. </view>
  183. </view>
  184. <view class="margin-top-xxxl padding-top-xxl">
  185. <view class="form-container">
  186. <view class="form-gorup">
  187. <view class="form-gorup-title">快递名称<text class="form-group-tips-must">*</text></view>
  188. <input type="text" @input="form_express_name_event" placeholder-class="cr-grey" class="cr-base" placeholder="请输入快递名称" :value="form_express_name">
  189. </view>
  190. <view class="form-gorup">
  191. <view class="form-gorup-title">快递单号<text class="form-group-tips-must">*</text></view>
  192. <input type="text" @input="form_express_number_event" placeholder-class="cr-grey" class="cr-base" placeholder="请输入快递单号" :value="form_express_number">
  193. </view>
  194. <view class="form-gorup form-gorup-submit">
  195. <button class="bg-main br-main cr-white round text-size" type="default" @tap="form_delivery_submit_event" hover-class="none" :disabled="form_button_disabled">提交</button>
  196. </view>
  197. </view>
  198. </view>
  199. </view>
  200. </component-popup>
  201. </view>
  202. </template>
  203. <script>
  204. const app = getApp();
  205. import componentPopup from "../../components/popup/popup";
  206. import componentNoData from "../../components/no-data/no-data";
  207. import componentBottomLine from "../../components/bottom-line/bottom-line";
  208. var common_static_url = app.globalData.get_static_url('common');
  209. export default {
  210. data() {
  211. return {
  212. common_static_url: common_static_url,
  213. params: null,
  214. data_list_loding_status: 1,
  215. data_list_loding_msg: '',
  216. data_bottom_line_status: false,
  217. popup_delivery_status: false,
  218. // 接口数据
  219. editor_path_type: '',
  220. order_data: null,
  221. new_aftersale_data: null,
  222. step_data: null,
  223. returned_data: null,
  224. return_only_money_reason: [],
  225. return_money_goods_reason: [],
  226. aftersale_type_list: [],
  227. reason_data_list: [],
  228. return_goods_address: null,
  229. // 售后基础信息
  230. panel_base_data_list: [{
  231. name: '退款类型',
  232. field: 'type_text'
  233. }, {
  234. name: '当前状态',
  235. field: 'status_text'
  236. }, {
  237. name: '申请原因',
  238. field: 'reason'
  239. }, {
  240. name: '退货数量',
  241. field: 'number'
  242. }, {
  243. name: '退款金额',
  244. field: 'price'
  245. }, {
  246. name: '退款说明',
  247. field: 'msg'
  248. }, {
  249. name: '退款方式',
  250. field: 'refundment_text'
  251. }, {
  252. name: '拒绝原因',
  253. field: 'refuse_reason'
  254. }, {
  255. name: '申请时间',
  256. field: 'apply_time'
  257. }, {
  258. name: '确认时间',
  259. field: 'confirm_time'
  260. }, {
  261. name: '退货时间',
  262. field: 'delivery_time'
  263. }, {
  264. name: '审核时间',
  265. field: 'audit_time'
  266. }, {
  267. name: '取消时间',
  268. field: 'cancel_time'
  269. }, {
  270. name: '添加时间',
  271. field: 'add_time'
  272. }, {
  273. name: '更新时间',
  274. field: 'upd_time'
  275. }],
  276. // 快递信息
  277. panel_express_data_list: [{
  278. name: '快递名称',
  279. field: 'express_name'
  280. }, {
  281. name: '快递单号',
  282. field: 'express_number'
  283. }, {
  284. name: '退货时间',
  285. field: 'delivery_time'
  286. }],
  287. // 表单数据
  288. form_button_disabled: false,
  289. form_type: null,
  290. form_reason_index: null,
  291. form_price: '',
  292. form_msg: '',
  293. form_number: 0,
  294. form_images_list: [],
  295. form_express_name: '',
  296. form_express_number: '',
  297. // 智能工具插件、客服信息展示
  298. plugins_intellectstools_data: null,
  299. plugins_intellectstools_service_status: false
  300. };
  301. },
  302. components: {
  303. componentPopup,
  304. componentNoData,
  305. componentBottomLine
  306. },
  307. props: {},
  308. onLoad(params) {
  309. this.setData({
  310. params: params,
  311. popup_delivery_status: (params.is_delivery_popup || 0) == 1
  312. });
  313. },
  314. onShow() {
  315. // 数据加载
  316. this.init();
  317. // 分享菜单处理
  318. app.globalData.page_share_handle();
  319. },
  320. // 下拉刷新
  321. onPullDownRefresh() {
  322. this.init();
  323. },
  324. methods: {
  325. // 获取数据
  326. init() {
  327. var self = this;
  328. uni.showLoading({
  329. title: '加载中...'
  330. });
  331. this.setData({
  332. data_list_loding_status: 1
  333. });
  334. uni.request({
  335. url: app.globalData.get_request_url("aftersale", "orderaftersale"),
  336. method: 'POST',
  337. data: {
  338. oid: this.params.oid,
  339. did: this.params.did
  340. },
  341. dataType: 'json',
  342. success: res => {
  343. uni.hideLoading();
  344. uni.stopPullDownRefresh();
  345. if (res.data.code == 0) {
  346. var data = res.data.data;
  347. self.setData({
  348. data_list_loding_status: 3,
  349. data_bottom_line_status: true,
  350. data_list_loding_msg: '',
  351. editor_path_type: data.editor_path_type || '',
  352. order_data: data.order_data || null,
  353. new_aftersale_data: (data.new_aftersale_data || null) == null || data.new_aftersale_data.length <= 0 ? null : data.new_aftersale_data,
  354. step_data: data.step_data || null,
  355. returned_data: data.returned_data || null,
  356. return_only_money_reason: data.return_only_money_reason || [],
  357. return_money_goods_reason: data.return_money_goods_reason || [],
  358. aftersale_type_list: data.aftersale_type_list || [],
  359. return_goods_address: data.return_goods_address || null,
  360. form_price: data.returned_data || null != null ? data.returned_data.refund_price : 0,
  361. plugins_intellectstools_data: data.plugins_intellectstools_data || null
  362. });
  363. } else {
  364. self.setData({
  365. data_list_loding_status: 0,
  366. data_bottom_line_status: false,
  367. data_list_loding_msg: res.data.msg
  368. });
  369. if (app.globalData.is_login_check(res.data, self, 'init')) {
  370. app.globalData.showToast(res.data.msg);
  371. }
  372. }
  373. },
  374. fail: () => {
  375. uni.hideLoading();
  376. uni.stopPullDownRefresh();
  377. self.setData({
  378. data_list_loding_status: 2,
  379. data_bottom_line_status: false,
  380. data_list_loding_msg: '服务器请求出错'
  381. });
  382. app.globalData.showToast('服务器请求出错');
  383. }
  384. });
  385. },
  386. // 类型选择
  387. form_type_event(e) {
  388. var value = e.currentTarget.dataset.value;
  389. this.setData({
  390. form_type: value,
  391. form_reason_index: this.form_type == value ? this.form_reason_index : null,
  392. reason_data_list: value == 0 ? this.return_only_money_reason : this.return_money_goods_reason,
  393. form_number: value == 0 ? 0 : this.returned_data.returned_quantity
  394. });
  395. },
  396. // 原因选择
  397. form_reason_event(e) {
  398. this.setData({
  399. form_reason_index: e.detail.value
  400. });
  401. },
  402. // 商品件数
  403. form_number_event(e) {
  404. this.setData({
  405. form_number: e.detail.value
  406. });
  407. },
  408. // 退款金额
  409. form_price_event(e) {
  410. this.setData({
  411. form_price: e.detail.value
  412. });
  413. },
  414. // 退款说明
  415. form_msg_event(e) {
  416. this.setData({
  417. form_msg: e.detail.value
  418. });
  419. },
  420. // 快递名称
  421. form_express_name_event(e) {
  422. this.setData({
  423. form_express_name: e.detail.value
  424. });
  425. },
  426. // 快递单号
  427. form_express_number_event(e) {
  428. this.setData({
  429. form_express_number: e.detail.value
  430. });
  431. },
  432. // 上传图片预览
  433. upload_show_event(e) {
  434. uni.previewImage({
  435. current: this.form_images_list[e.currentTarget.dataset.index],
  436. urls: this.form_images_list
  437. });
  438. },
  439. // 图片删除
  440. upload_delete_event(e) {
  441. var self = this;
  442. uni.showModal({
  443. title: '温馨提示',
  444. content: '删除后不可恢复、继续吗?',
  445. success(res) {
  446. if (res.confirm) {
  447. var list = self.form_images_list;
  448. list.splice(e.currentTarget.dataset.index, 1);
  449. self.setData({
  450. form_images_list: list
  451. });
  452. }
  453. }
  454. });
  455. },
  456. // 文件上传
  457. file_upload_event(e) {
  458. var self = this;
  459. uni.chooseImage({
  460. count: 3,
  461. success(res) {
  462. var success = 0;
  463. var fail = 0;
  464. var length = res.tempFilePaths.length;
  465. var count = 0;
  466. self.upload_one_by_one(res.tempFilePaths, success, fail, count, length);
  467. }
  468. });
  469. },
  470. // 采用递归的方式上传多张
  471. upload_one_by_one(img_paths, success, fail, count, length) {
  472. var self = this;
  473. if (self.form_images_list.length < 3) {
  474. uni.uploadFile({
  475. url: app.globalData.get_request_url("index", "ueditor"),
  476. filePath: img_paths[count],
  477. name: 'upfile',
  478. formData: {
  479. action: 'uploadimage',
  480. path_type: self.editor_path_type
  481. },
  482. success: function(res) {
  483. success++;
  484. if (res.statusCode == 200) {
  485. var data = typeof res.data == 'object' ? res.data : JSON.parse(res.data);
  486. if (data.code == 0 && (data.data.url || null) != null) {
  487. var list = self.form_images_list;
  488. list.push(data.data.url);
  489. self.setData({
  490. form_images_list: list
  491. });
  492. } else {
  493. app.globalData.showToast(data.msg);
  494. }
  495. }
  496. },
  497. fail: function(e) {
  498. fail++;
  499. },
  500. complete: function(e) {
  501. count++;
  502. // 下一张
  503. if (count >= length) {
  504. // 上传完毕,作一下提示
  505. //app.showToast('上传成功' + success +'张', 'success');
  506. } else {
  507. // 递归调用,上传下一张
  508. self.upload_one_by_one(img_paths, success, fail, count, length);
  509. }
  510. }
  511. });
  512. }
  513. },
  514. // 售后表单提交
  515. form_submit_event(e) {
  516. // 表单数据
  517. var form_data = {
  518. order_id: this.params.oid,
  519. order_detail_id: this.params.did,
  520. type: this.form_type,
  521. reason: this.reason_data_list[this.form_reason_index],
  522. number: this.form_type == 0 ? 0 : this.form_number,
  523. price: this.form_price,
  524. msg: this.form_msg,
  525. images: this.form_images_list.length > 0 ? JSON.stringify(this.form_images_list) : ''
  526. };
  527. // 防止金额大于计算的金额
  528. if (form_data['price'] > this.returned_data['refund_price']) {
  529. form_data['price'] = this.returned_data['refund_price'];
  530. }
  531. // 防止数量大于计算的数量
  532. if (form_data['number'] > this.returned_data['returned_quantity']) {
  533. form_data['number'] = this.returned_data['returned_quantity'];
  534. }
  535. // 数据校验
  536. var validation = [{
  537. fields: "type",
  538. msg: "请选择操作类型",
  539. is_can_zero: 1
  540. }, {
  541. fields: "reason",
  542. msg: "请选择原因"
  543. }];
  544. if (form_data['type'] == 1) {
  545. validation.push({
  546. fields: "number",
  547. msg: "请选择退货数量"
  548. });
  549. }
  550. // 校验参数并提交
  551. if (app.globalData.fields_check(form_data, validation)) {
  552. var self = this;
  553. uni.showLoading({
  554. title: '处理中...'
  555. });
  556. self.setData({
  557. form_button_disabled: true
  558. });
  559. uni.request({
  560. url: app.globalData.get_request_url("create", "orderaftersale"),
  561. method: 'POST',
  562. data: form_data,
  563. dataType: 'json',
  564. success: res => {
  565. uni.hideLoading();
  566. if (res.data.code == 0) {
  567. app.globalData.showToast(res.data.msg, 'success');
  568. setTimeout(function() {
  569. self.setData({
  570. form_button_disabled: false
  571. });
  572. self.init();
  573. }, 1000);
  574. } else {
  575. self.setData({
  576. form_button_disabled: false
  577. });
  578. app.globalData.showToast(res.data.msg);
  579. }
  580. },
  581. fail: () => {
  582. uni.hideLoading();
  583. self.setData({
  584. form_button_disabled: false
  585. });
  586. app.globalData.showToast('服务器请求出错');
  587. }
  588. });
  589. }
  590. },
  591. // 退货开启弹层
  592. delivery_submit_event(e) {
  593. this.setData({
  594. popup_delivery_status: true
  595. });
  596. },
  597. // 退货弹层关闭
  598. popup_delivery_close_event(e) {
  599. this.setData({
  600. popup_delivery_status: false
  601. });
  602. },
  603. // 退货表单
  604. form_delivery_submit_event(e) {
  605. // 表单数据
  606. var form_data = {
  607. id: this.new_aftersale_data.id,
  608. express_name: this.form_express_name,
  609. express_number: this.form_express_number
  610. };
  611. // 数据校验
  612. var validation = [{
  613. fields: "express_name",
  614. msg: "请填写快递名称"
  615. }, {
  616. fields: "express_number",
  617. msg: "请填写快递单号"
  618. }];
  619. // 校验参数并提交
  620. if (app.globalData.fields_check(form_data, validation)) {
  621. var self = this;
  622. uni.showLoading({
  623. title: '处理中...'
  624. });
  625. self.setData({
  626. form_button_disabled: true
  627. });
  628. uni.request({
  629. url: app.globalData.get_request_url("delivery", "orderaftersale"),
  630. method: 'POST',
  631. data: form_data,
  632. dataType: 'json',
  633. success: res => {
  634. uni.hideLoading();
  635. self.setData({
  636. popup_delivery_status: false
  637. });
  638. if (res.data.code == 0) {
  639. app.globalData.showToast(res.data.msg, 'success');
  640. setTimeout(function() {
  641. self.setData({
  642. form_button_disabled: false
  643. });
  644. self.init();
  645. }, 1000);
  646. } else {
  647. self.setData({
  648. form_button_disabled: false
  649. });
  650. app.globalData.showToast(res.data.msg);
  651. }
  652. },
  653. fail: () => {
  654. uni.hideLoading();
  655. self.setData({
  656. form_button_disabled: false
  657. });
  658. app.globalData.showToast('服务器请求出错');
  659. }
  660. });
  661. }
  662. },
  663. // 凭证图片预览
  664. images_view_event(e) {
  665. uni.previewImage({
  666. current: this.new_aftersale_data.images[e.currentTarget.dataset.index],
  667. urls: this.new_aftersale_data.images
  668. });
  669. },
  670. // 查看售后数据
  671. show_aftersale_event(e) {
  672. uni.navigateTo({
  673. url: "/pages/user-orderaftersale/user-orderaftersale?keywords=" + this.new_aftersale_data.order_no
  674. });
  675. },
  676. // 客服事件
  677. plugins_intellectstools_service_event(e) {
  678. this.setData({
  679. plugins_intellectstools_service_status: !this.plugins_intellectstools_service_status
  680. });
  681. },
  682. // 客服电话
  683. tel_event(e) {
  684. app.globalData.call_tel(e.currentTarget.dataset.value);
  685. },
  686. // 剪切板
  687. text_copy_event(e) {
  688. app.globalData.text_copy_event(e);
  689. },
  690. // 图片预览
  691. image_show_event(e) {
  692. app.globalData.image_show_event(e);
  693. },
  694. // 进入客服系统
  695. chat_event() {
  696. app.globalData.chat_entry_handle(this.plugins_intellectstools_data.chat.chat_url);
  697. }
  698. }
  699. };
  700. </script>
  701. <style>
  702. @import './user-orderaftersale-detail.css';
  703. </style>