index.vue 5.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237
  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. this.setData({
  85. list: data.reason,
  86. express: express,
  87. refund: data.refund
  88. });
  89. // console.log(this.refundType, this.isrefund);
  90. }); // }
  91. } // created: function() {
  92. // // 页面被展示
  93. // // req.getStorage('isrefund')
  94. // let isrefund=req.getStorage('isrefund')
  95. // let express=isrefund.express
  96. // express.splice(isrefund.express.length - 3, 3)
  97. // this.setData({list:isrefund.reason,express:express})
  98. // console.log(this.data.list,this.data.express)
  99. // },
  100. ,
  101. options: {
  102. addGlobalClass: true
  103. },
  104. methods: {
  105. radioChange(e) {
  106. // console.log(e); // console.log(this.data.refundType)
  107. // console.log('radio发生change事件,携带value值为:', e.detail.value)
  108. if (this.refundType == 1) {
  109. if (this.isrefund == 1) {
  110. let list = this.refund;
  111. for (let i = 0, len = list.length; i < len; ++i) {
  112. if (list[i].value == e.detail.value) {
  113. list[i].checked = true;
  114. this.setData({
  115. value: list[i].label,
  116. listtype: list[i].value
  117. });
  118. }
  119. }
  120. } else {
  121. let list = this.list;
  122. for (let i = 0, len = list.length; i < len; ++i) {
  123. if (list[i].value == e.detail.value) {
  124. list[i].checked = true;
  125. this.setData({
  126. value: list[i].label,
  127. listtype: list[i].value
  128. });
  129. }
  130. }
  131. }
  132. }
  133. if (this.refundType == 2) {
  134. let list = this.goods;
  135. for (let i = 0, len = list.length; i < len; ++i) {
  136. if (list[i].value == e.detail.value) {
  137. list[i].checked = true;
  138. this.setData({
  139. huo: list[i].label,
  140. huotype: list[i].value
  141. });
  142. }
  143. }
  144. }
  145. if (this.refundType == 3) {
  146. let list = this.goodstare;
  147. for (let i = 0, len = list.length; i < len; ++i) {
  148. if (list[i].value == e.detail.value) {
  149. list[i].checked = true;
  150. this.setData({
  151. start: list[i].label,
  152. starttype: list[i].value
  153. });
  154. this.setData({
  155. list
  156. });
  157. }
  158. }
  159. }
  160. if (this.refundType == 4) {
  161. let express = this.express;
  162. for (let i = 0, len = express.length; i < len; ++i) {
  163. if (express[i].value == e.detail.value) {
  164. // express[i].checked = true
  165. this.setData({
  166. start: express[i].label,
  167. expresstype: express[i].value
  168. }); // this.setData({ express })
  169. }
  170. }
  171. }
  172. },
  173. hidePopup() {
  174. this.$emit('hidePopup');
  175. },
  176. getValue() {
  177. if (this.refundType == 1) {
  178. this.$emit('getValue', {
  179. detail: this.value
  180. });
  181. this.$emit('getIndex', {
  182. detail: this.listtype
  183. });
  184. }
  185. if (this.refundType == 2) {
  186. this.$emit('getValue', {
  187. detail: this.huo
  188. });
  189. this.$emit('getIndex', {
  190. detail: this.huotype
  191. });
  192. }
  193. if (this.refundType == 3) {
  194. this.$emit('getValue', {
  195. detail: this.start
  196. });
  197. this.$emit('getIndex', {
  198. detail: this.starttype
  199. });
  200. }
  201. if (this.refundType == 4) {
  202. this.$emit('getValue', {
  203. detail: this.start
  204. });
  205. this.$emit('getIndex', {
  206. detail: this.expresstype
  207. });
  208. }
  209. this.hidePopup();
  210. }
  211. }
  212. };
  213. </script>
  214. <style>
  215. @import "./index.css";
  216. </style>