index.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245
  1. <template>
  2. <view>
  3. <!--components/refund-popup/index.wxml-->
  4. <view class="mask" @tap="hidePopup"></view>
  5. <view class="popup">
  6. <view class="pop">
  7. <text class="txt">{{refundType==1?"退款原因":refundType==2?"退货方式":refundType==3?"货物状态":"快递公司"}}</text>
  8. </view>
  9. <view class="close" @tap="hidePopup">
  10. <image class="image" src="/static/pages/images/close.png"></image>
  11. </view>
  12. <scroll-view scroll-y="true" style="height: 500rpx;">
  13. <radio-group @change="radioChange">
  14. <label v-for="(item, index) in refundType==1&&isrefund==2?list:refundType==2?goods:refundType==3?goodstare:refundType==1&&isrefund==1?refund:express" :key="index" class="li">
  15. <view class="cont">
  16. <view class="weui-cell__bd">{{item.label}}</view>
  17. </view>
  18. <radio :value="item.value" :checked="item.checked" class="right" :data-index="item.value" color="red"></radio>
  19. </label>
  20. </radio-group>
  21. </scroll-view>
  22. <view class="confirm mbglinear" @tap="getValue">确定</view>
  23. </view>
  24. </view>
  25. </template>
  26. <script>
  27. // components/refund-popup/index.js
  28. const req = require("../../utils/request");
  29. export default {
  30. data() {
  31. return {
  32. list: [],
  33. goods: [{
  34. label: "送回门店",
  35. value: 2
  36. }, {
  37. label: "邮寄",
  38. value: 1
  39. }, {
  40. label: "货物拒收",
  41. value: 3
  42. }],
  43. goodstare: [{
  44. label: "未收货",
  45. value: 1
  46. }, {
  47. label: "已收货",
  48. value: 2
  49. }],
  50. express: [],
  51. refund: [],
  52. value: "",
  53. listtype: "",
  54. huo: "",
  55. huotype: "",
  56. start: "",
  57. starttype: "",
  58. expresstype: ""
  59. };
  60. },
  61. components: {},
  62. props: {
  63. // 1 为退款原因 2为退货方式 3为货物状态 4为物流方式
  64. refundType: {
  65. type: String,
  66. default: ''
  67. },
  68. isrefund: {
  69. type: String,
  70. default: ''
  71. }
  72. },
  73. mounted() {
  74. // if (req.getStorage('isrefund')) {
  75. // let isrefund=req.getStorage('isrefund')
  76. // let express=isrefund.express
  77. // express.splice(isrefund.express.length - 3, 3)
  78. // this.setData({list:isrefund.reason,express:express})
  79. // console.log(this.data.list,this.data.express)
  80. // }else{
  81. req.getRequest('/api/orderRefund/refundReason', '', data => {
  82. let express = data.express;
  83. express.splice(data.express.length - 3, 3);
  84. let reason = data.reason.map((it,idx)=>{
  85. console.log('退款原因===',it)
  86. if(it.label!='审方失败'){
  87. return it;
  88. }
  89. })
  90. this.setData({
  91. list: reason,
  92. express: express,
  93. refund: data.refund
  94. });
  95. // console.log(this.refundType, this.isrefund);
  96. }); // }
  97. } // created: function() {
  98. // // 页面被展示
  99. // // req.getStorage('isrefund')
  100. // let isrefund=req.getStorage('isrefund')
  101. // let express=isrefund.express
  102. // express.splice(isrefund.express.length - 3, 3)
  103. // this.setData({list:isrefund.reason,express:express})
  104. // console.log(this.data.list,this.data.express)
  105. // },
  106. ,
  107. options: {
  108. addGlobalClass: true
  109. },
  110. methods: {
  111. radioChange(e) {
  112. // console.log(e); // console.log(this.data.refundType)
  113. // console.log('radio发生change事件,携带value值为:', e.detail.value)
  114. if (this.refundType == 1) {
  115. if (this.isrefund == 1) {
  116. let list = this.refund;
  117. for (let i = 0, len = list.length; i < len; ++i) {
  118. if (list[i].value == e.detail.value) {
  119. list[i].checked = true;
  120. this.setData({
  121. value: list[i].label,
  122. listtype: list[i].value
  123. });
  124. }
  125. }
  126. } else {
  127. let list = this.list;
  128. for (let i = 0, len = list.length; i < len; ++i) {
  129. if (list[i].value == e.detail.value) {
  130. list[i].checked = true;
  131. this.setData({
  132. value: list[i].label,
  133. listtype: list[i].value
  134. });
  135. }
  136. }
  137. }
  138. }
  139. if (this.refundType == 2) {
  140. let list = this.goods;
  141. for (let i = 0, len = list.length; i < len; ++i) {
  142. if (list[i].value == e.detail.value) {
  143. list[i].checked = true;
  144. this.setData({
  145. huo: list[i].label,
  146. huotype: list[i].value
  147. });
  148. }
  149. }
  150. }
  151. if (this.refundType == 3) {
  152. let list = this.goodstare;
  153. for (let i = 0, len = list.length; i < len; ++i) {
  154. if (list[i].value == e.detail.value) {
  155. list[i].checked = true;
  156. this.setData({
  157. start: list[i].label,
  158. starttype: list[i].value
  159. });
  160. this.setData({
  161. list
  162. });
  163. }
  164. }
  165. }
  166. if (this.refundType == 4) {
  167. let express = this.express;
  168. for (let i = 0, len = express.length; i < len; ++i) {
  169. if (express[i].value == e.detail.value) {
  170. // express[i].checked = true
  171. this.setData({
  172. start: express[i].label,
  173. expresstype: express[i].value
  174. }); // this.setData({ express })
  175. }
  176. }
  177. }
  178. },
  179. hidePopup() {
  180. this.$emit('hidePopup', {
  181. detail: this
  182. });
  183. },
  184. getValue() {
  185. if (this.refundType == 1) {
  186. this.$emit('getValue', {
  187. detail: this.value
  188. });
  189. this.$emit('getIndex', {
  190. detail: this.listtype
  191. });
  192. }
  193. if (this.refundType == 2) {
  194. this.$emit('getValue', {
  195. detail: this.huo
  196. });
  197. this.$emit('getIndex', {
  198. detail: this.huotype
  199. });
  200. }
  201. if (this.refundType == 3) {
  202. this.$emit('getValue', {
  203. detail: this.start
  204. });
  205. this.$emit('getIndex', {
  206. detail: this.starttype
  207. });
  208. }
  209. if (this.refundType == 4) {
  210. this.$emit('getValue', {
  211. detail: this.start
  212. });
  213. this.$emit('getIndex', {
  214. detail: this.expresstype
  215. });
  216. }
  217. this.hidePopup();
  218. }
  219. }
  220. };
  221. </script>
  222. <style>
  223. @import "./index.css";
  224. </style>