after.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325
  1. <template>
  2. <view class="main">
  3. <view class="one">
  4. <view class="one_1">
  5. <image v-if="info.source&&info.source.file.length>0" class="image"
  6. :src="info.source.file&&info.source.file.length>0?info.source.file[0].url:''">
  7. </image>
  8. <image v-else class="image" :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
  9. </image>
  10. <text v-if="info.type=='0'">酒店民宿</text>
  11. <text v-else>景区门票</text>
  12. </view>
  13. <view class="one_2">
  14. <view class="left">
  15. <image v-if="info.source&&info.source.file.length>0" class="image"
  16. :src="info.source.file&&info.source.file.length>0?info.source.file[0].url:''">
  17. </image>
  18. <image v-else class="image"
  19. :src="config.logo_url&&config.logo_url.length>0?config.logo_url[0].url:''">
  20. </image>
  21. </view>
  22. <view class="right">
  23. <view class="right_1">
  24. <view class="left">
  25. <view class="name textOver">{{info.source_name||'暂无'}}</view>
  26. <view class="other">{{info.zhType||'暂无'}}</view>
  27. <view class="other">{{info.zhPerson||'暂无'}}</view>
  28. </view>
  29. <view class="right">
  30. <view class="other">
  31. ¥{{info.source.money||'0'}}
  32. </view>
  33. <view class="other">
  34. ×{{info.num||'0'}}
  35. </view>
  36. </view>
  37. </view>
  38. <view class="right_2">
  39. 合计:¥{{info.money||'0'}}
  40. </view>
  41. </view>
  42. </view>
  43. </view>
  44. <view class="two">
  45. <uni-forms class="form" ref="form" :rules="rules" :modelValue="form" label-position="top" label-width='100'>
  46. <uni-forms-item label="退款理由(必填)" required name="reason">
  47. <uni-easyinput type="textarea" v-model="form.reason" placeholder="请输入退款理由" />
  48. </uni-forms-item>
  49. <uni-forms-item label="上传图片0/3(选填)" name="file">
  50. <upload class='upload' :list="form.file" name="file" :count="3" @uplSuc="uplSuc" @uplDel="uplDel">
  51. </upload>
  52. </uni-forms-item>
  53. </uni-forms>
  54. <button class="button" type="primary" @click="submit('form')">提交</button>
  55. </view>
  56. </view>
  57. </template>
  58. <script>
  59. import moment from 'moment';
  60. import upload from '../../components/upload/index.vue';
  61. export default {
  62. components: {
  63. upload
  64. },
  65. data() {
  66. return {
  67. id: '',
  68. config: {
  69. logo_url: []
  70. },
  71. user: {},
  72. info: {
  73. source: {
  74. file: []
  75. }
  76. },
  77. form: {
  78. file: []
  79. },
  80. statusList: [],
  81. personList: [],
  82. typeList: [],
  83. // 校验规则
  84. rules: {
  85. reason: {
  86. rules: [{
  87. required: true,
  88. errorMessage: '请输入退款理由'
  89. }]
  90. },
  91. },
  92. }
  93. },
  94. onLoad: async function(e) {
  95. const that = this;
  96. that.$set(that, `id`, e && e.id || '');
  97. that.searchConfig();
  98. that.searchToken();
  99. await that.searchOther();
  100. that.search();
  101. },
  102. methods: {
  103. searchConfig() {
  104. const that = this;
  105. try {
  106. const res = uni.getStorageSync('config');
  107. if (res) that.$set(that, `config`, res);
  108. } catch (e) {
  109. uni.showToast({
  110. title: err.errmsg,
  111. icon: 'error',
  112. duration: 2000
  113. });
  114. }
  115. },
  116. searchToken() {
  117. const that = this;
  118. try {
  119. const res = uni.getStorageSync('token');
  120. if (res) {
  121. that.$set(that, `user`, res);
  122. }
  123. } catch (e) {
  124. uni.showToast({
  125. title: err.errmsg,
  126. icon: 'error',
  127. duration: 2000
  128. });
  129. }
  130. },
  131. async search() {
  132. const that = this;
  133. if (that.id) {
  134. const res = await that.$api(`/order/${that.id}`, 'GET', {})
  135. if (res.errcode == '0') {
  136. const status = that.statusList.find(i => i.value == res.data.status)
  137. if (status) res.data.zhStatus = status.label
  138. if (res.data && res.data.source && res.data.source.person) {
  139. const person = that.personList.find(i => i.value == res.data.source.person)
  140. if (person) res.data.zhPerson = person.label
  141. }
  142. if (res.data && res.data.source && res.data.source.type) {
  143. const type = that.typeList.find(i => i.value == res.data.source.type)
  144. if (type) res.data.zhType = type.label
  145. }
  146. that.$set(that, `info`, res.data)
  147. } else {
  148. uni.showToast({
  149. title: res.errmsg,
  150. });
  151. }
  152. }
  153. },
  154. // 图片上传
  155. uplSuc(e) {
  156. const that = this;
  157. that.$set(that.form, `${e.name}`, [...that.form[e.name], e.data]);
  158. },
  159. // 图片删除
  160. uplDel(e) {
  161. const that = this;
  162. let data = that.form[e.name];
  163. let arr = data.filter((i, index) => index != e.data.index);
  164. that.$set(that.form, `${e.name}`, arr)
  165. },
  166. submit(ref) {
  167. const that = this;
  168. that.$refs[ref].validate().then(async data => {
  169. data.user = that.user._id
  170. data.order = that.id
  171. data.type = that.info.type
  172. data.apply_time = moment().format('YYYY-MM-DD HH:mm:ss')
  173. const res = await that.$api(`/afterSale`, 'POST', data);
  174. if (res.errcode == '0') {
  175. const arr = await that.$api(`/order/${that.id}`, 'POST', {
  176. status: "5"
  177. })
  178. if (arr.errcode == '0') {
  179. uni.showToast({
  180. title: '售后申请成功',
  181. icon: 'none'
  182. })
  183. uni.navigateBack({
  184. delta: 1
  185. })
  186. } else {
  187. uni.showToast({
  188. title: res.errmsg,
  189. });
  190. }
  191. } else {
  192. uni.showToast({
  193. title: res.errmsg,
  194. icon: 'none'
  195. })
  196. }
  197. }).catch(err => {
  198. console.log('err', err);
  199. })
  200. },
  201. // 查询其他信息
  202. async searchOther() {
  203. const that = this;
  204. let res;
  205. // 查询类型
  206. res = await that.$api(`/dictData`, 'GET', {
  207. type: 'order_status',
  208. is_use: '0',
  209. })
  210. if (res.errcode == '0') that.$set(that, `statusList`, res.data);
  211. // 出游人群
  212. res = await that.$api(`/dictData`, 'GET', {
  213. type: 'ticket_person',
  214. is_use: '0',
  215. })
  216. if (res.errcode == '0') that.$set(that, `personList`, res.data);
  217. // 服务特色
  218. res = await that.$api(`/dictData`, 'GET', {
  219. type: 'ticket_type',
  220. is_use: '0',
  221. })
  222. if (res.errcode == '0') that.$set(that, `typeList`, res.data);
  223. },
  224. }
  225. }
  226. </script>
  227. <style lang="scss" scoped>
  228. .main {
  229. .one {
  230. background-color: var(--mainColor);
  231. border-radius: 5px;
  232. margin: 2vw 2vw 0 2vw;
  233. padding: 2vw;
  234. border: 1px solid #d5d5da;
  235. .one_1 {
  236. display: flex;
  237. align-items: center;
  238. .image {
  239. width: 8vw;
  240. height: 8vw;
  241. border-radius: 8vw;
  242. }
  243. text {
  244. padding: 0 0 0 2vw;
  245. }
  246. }
  247. .one_2 {
  248. display: flex;
  249. justify-content: space-between;
  250. margin: 2vw 0 0 0;
  251. padding: 0 2vw;
  252. .left {
  253. width: 20vw;
  254. .image {
  255. width: 20vw;
  256. height: 20vw;
  257. border-radius: 1vw;
  258. }
  259. }
  260. .right {
  261. width: 65vw;
  262. margin: 0 0 0 2vw;
  263. .right_1 {
  264. display: flex;
  265. justify-content: space-between;
  266. .left {
  267. width: 55vw;
  268. .name {
  269. font-size: var(--font14Size);
  270. }
  271. .other {
  272. padding: 2px 0 0 0;
  273. font-size: var(--font12Size);
  274. color: var(--f85Color);
  275. }
  276. }
  277. .right {
  278. width: 10vw;
  279. text-align: right;
  280. .other {
  281. padding: 2px 0 0 0;
  282. font-size: var(--font12Size);
  283. color: var(--f85Color);
  284. }
  285. }
  286. }
  287. .right_2 {
  288. text-align: right;
  289. font-size: var(--font12Size);
  290. }
  291. }
  292. }
  293. }
  294. .two {
  295. padding: 2vw;
  296. .form-item {
  297. display: flex;
  298. align-items: center;
  299. }
  300. .button {
  301. background-color: var(--f3CColor);
  302. }
  303. }
  304. }
  305. </style>