statistics.vue 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302
  1. <template>
  2. <view class="statis">
  3. <view class="order-setuo">
  4. <view class="order-title">余额支付</view>
  5. <view class="order-list">
  6. <view class="list-left">是否启用</view>
  7. <view class="list-right">
  8. <ns-switch class="switch" :checked="statisticsData.balance_config.balance_show == 1" @change="balanceShow()"></ns-switch>
  9. </view>
  10. </view>
  11. </view>
  12. <view class="order-setuo">
  13. <view class="order-title">订单设置</view>
  14. <view class="order-list">
  15. <view class="list-left">未付款自动关闭时间</view>
  16. <view class="list-right"><input type="text" v-model="statisticsData.order_event_time_config.auto_close" placeholder="0" />分钟</view>
  17. </view>
  18. <view class="order-list">
  19. <view class="list-left">发货后自动收货时间</view>
  20. <view class="list-right"><input type="text" v-model="statisticsData.order_event_time_config.auto_take_delivery" placeholder="0" />天</view>
  21. </view>
  22. <view class="order-list">
  23. <view class="list-left">收货后自动完成时间</view>
  24. <view class="list-right"><input type="text" v-model="statisticsData.order_event_time_config.auto_complete" placeholder="0" />天</view>
  25. </view>
  26. <view class="order-list">
  27. <view class="list-left">完成后可维权时间</view>
  28. <view class="list-right"><input type="text" v-model="statisticsData.order_event_time_config.after_sales_time" placeholder="0" />天</view>
  29. </view>
  30. </view>
  31. <view class="order-setuo">
  32. <view class="order-title">评价设置</view>
  33. <view class="order-list">
  34. <view class="list-left">订单评价</view>
  35. <view class="list-right">
  36. <ns-switch class="switch" :checked="statisticsData.order_evaluate_config.evaluate_status == 1" @change="isFree()"></ns-switch>
  37. </view>
  38. </view>
  39. <view class="order-list">
  40. <view class="list-left">显示评价</view>
  41. <view class="list-right">
  42. <ns-switch class="switch" :checked="statisticsData.order_evaluate_config.evaluate_show == 1" @change="evaluateShow()"></ns-switch>
  43. </view>
  44. </view>
  45. <view class="order-list">
  46. <view class="list-left">评价审核</view>
  47. <view class="list-right">
  48. <ns-switch class="switch" :checked="statisticsData.order_evaluate_config.evaluate_audit == 1" @change="evaluateAudit()"></ns-switch>
  49. </view>
  50. </view>
  51. </view>
  52. <view class="order-setuo">
  53. <view class="order-title">发票设置</view>
  54. <view class="order-list">
  55. <view class="list-left">发票开关</view>
  56. <view class="list-right">
  57. <!-- <switch :checked="statisticsData.order_event_time_config.invoice_status == 1" style="transform: scale(0.8,0.8);" /> -->
  58. <ns-switch class="switch" :checked="statisticsData.order_event_time_config.invoice_status == 1" @change="invoiceStatus()"></ns-switch>
  59. </view>
  60. </view>
  61. <view class="order-list">
  62. <view class="list-left">发票税率</view>
  63. <view class="list-right"><input type="text" v-model="statisticsData.order_event_time_config.invoice_rate" placeholder="0" /></view>
  64. </view>
  65. <view class="order-list">
  66. <view class="list-left">发票内容</view>
  67. <view class="list-right" @click="onContent()">
  68. <!-- <input type="text" v-model="invoicecontent" placeholder="请填写发票内容" /> -->
  69. <view class="order-content">请填写发票内容</view>
  70. <text class="iconfont iconright"></text>
  71. </view>
  72. </view>
  73. <view class="order-list">
  74. <view class="list-left">邮寄费用</view>
  75. <view class="list-right"><input type="text" v-model="statisticsData.order_event_time_config.invoice_money" placeholder="0" />元</view>
  76. </view>
  77. <view class="order-list">
  78. <view class="list-left">支持发票类型</view>
  79. <view class="list-right">
  80. <checkbox-group @change="onOrdinary">
  81. <label>
  82. <checkbox style="transform:scale(0.7)" class="uni-checkbox-input" value="1" :checked="isOrdinary[0] == 1" />普通发票
  83. </label>
  84. <label style="margin-left:30rpx;">
  85. <checkbox style="transform:scale(0.7)" class="uni-checkbox-input" value="2" :checked="isOrdinary[1] == 2" />电子发票
  86. </label>
  87. </checkbox-group>
  88. </view>
  89. </view>
  90. </view>
  91. <!-- <button class="btn" type="default">保存</button> -->
  92. <view class="footer-wrap"><button type="primary" @click="save()">保存</button></view>
  93. <!-- <loading-cover ref="loadingCover"></loading-cover> -->
  94. </view>
  95. </template>
  96. <script>
  97. export default {
  98. data() {
  99. return {
  100. statisticsData: {
  101. balance_config:{
  102. balance_show:""
  103. },
  104. order_evaluate_config: {
  105. evaluate_audit: "",
  106. evaluate_show: "",
  107. evaluate_status: ""
  108. },
  109. order_event_time_config: {
  110. after_sales_time: "",
  111. auto_close: "",
  112. auto_complete: "",
  113. auto_take_delivery: "",
  114. invoice_content: [],
  115. invoice_money: "",
  116. invoice_rate: "",
  117. invoice_status: "",
  118. invoice_type: []
  119. }
  120. },
  121. unpaid: null,
  122. receiving: null,
  123. complete: null,
  124. protection: null,
  125. isOrderEvaluation: false,
  126. isDisplayEvaluation: false,
  127. isEvaluationExamine: false,
  128. invoiceFlag: false,
  129. taxrate: null,
  130. invoicecontent: '',
  131. mailingfee: null,
  132. isOrdinary: [],
  133. isElectronics: false,
  134. };
  135. },
  136. onShow() {
  137. },
  138. mounted(){
  139. this.nvoiceData()
  140. },
  141. methods: {
  142. onOrdinary(e){
  143. this.isOrdinary = e.detail.value
  144. },
  145. // onElectronics(){this.isElectronics = this.isElectronics == true ? false : true},
  146. balanceShow() {this.statisticsData.balance_config.balance_show = this.statisticsData.balance_config.balance_show == 1 ? 0 : 1},
  147. isFree() {this.statisticsData.order_evaluate_config.evaluate_status = this.statisticsData.order_evaluate_config.evaluate_status == 1 ? 0 : 1},
  148. evaluateShow(){this.statisticsData.order_evaluate_config.evaluate_show = this.statisticsData.order_evaluate_config.evaluate_show == 1 ? 0 : 1},
  149. evaluateAudit(){this.statisticsData.order_evaluate_config.evaluate_audit = this.statisticsData.order_evaluate_config.evaluate_audit == 1 ? 0 : 1},
  150. invoiceStatus(){this.statisticsData.order_event_time_config.invoice_status = this.statisticsData.order_event_time_config.invoice_status == 1 ? 0 : 1},
  151. nvoiceData(){
  152. this.$api.sendRequest({
  153. url: '/shopapi/order/config',
  154. data: '',
  155. success: res => {
  156. if (res.code == 0 && res.data) {
  157. console.log(res.data)
  158. this.statisticsData = res.data
  159. let checkoutData = res.data.order_event_time_config.invoice_type
  160. this.isCheck = res.data.order_event_time_config.invoice_type
  161. for(let i=0;i<checkoutData.length;i++){
  162. // if(checkoutData[i] == 1){
  163. this.isOrdinary = checkoutData
  164. // }else if(checkoutData[i] == 2){
  165. // this.isElectronics = true
  166. // }
  167. }
  168. }
  169. }
  170. })
  171. },
  172. save(){
  173. if(uni.getStorageSync('invoicecontent')){
  174. console.log(uni.getStorageSync('invoicecontent'), '010101..')
  175. this.statisticsData.order_event_time_config.invoice_content = uni.getStorageSync('invoicecontent')
  176. for(let i=0;i<this.statisticsData.order_event_time_config.invoice_content.length;i++){
  177. if(this.statisticsData.order_event_time_config.invoice_content[i] == ''){
  178. this.statisticsData.order_event_time_config.invoice_content.splice(i,1)
  179. }
  180. }
  181. }
  182. this.$api.sendRequest({
  183. url: '/shopapi/order/setconfig',
  184. data: {
  185. balance_show: this.statisticsData.balance_config.balance_show,
  186. order_auto_close_time: this.statisticsData.order_event_time_config.auto_close,
  187. order_auto_take_delivery_time: this.statisticsData.order_event_time_config.auto_take_delivery,
  188. order_auto_complete_time: this.statisticsData.order_event_time_config.auto_complete,
  189. after_sales_time: this.statisticsData.order_event_time_config.after_sales_time,
  190. evaluate_status: this.statisticsData.order_evaluate_config.evaluate_status,
  191. evaluate_show: this.statisticsData.order_evaluate_config.evaluate_show,
  192. evaluate_audit: this.statisticsData.order_evaluate_config.evaluate_audit,
  193. invoice_status: this.statisticsData.order_event_time_config.invoice_status,
  194. invoice_rate: this.statisticsData.order_event_time_config.invoice_rate,
  195. invoice_content: this.statisticsData.order_event_time_config.invoice_content,
  196. invoice_money: this.statisticsData.order_event_time_config.invoice_money,
  197. invoice_type: this.isOrdinary,
  198. },
  199. success: res => {
  200. // var msg = res.message;
  201. if (res.code ==0) {
  202. this.$util.showToast({
  203. title: '保存成功'
  204. });
  205. this.$util.redirectTo('/pages/index/all_menu')
  206. }
  207. }
  208. })
  209. },
  210. onContent(){
  211. this.$util.redirectTo('/pages/my/nvoice/nvoice',{list: JSON.stringify(this.statisticsData.order_event_time_config.invoice_content)})
  212. }
  213. }
  214. };
  215. </script>
  216. <style lang="scss">
  217. .statis{
  218. .order-setuo {
  219. margin:20rpx 30rpx;
  220. background: #fff;
  221. padding:15rpx 30rpx;
  222. border-radius: 10rpx;
  223. .order-list {
  224. display: flex;
  225. flex-direction: row;
  226. justify-content: space-between;
  227. align-items: center;
  228. border-bottom:1px solid #eee;
  229. padding:20rpx 0;
  230. .list-right {
  231. display: flex;
  232. flex-direction: row;
  233. align-items: center;
  234. font-size: 28rpx;
  235. font-family: PingFang SC;
  236. font-weight: 500;
  237. color: #303133;
  238. input {
  239. font-size: 28rpx;
  240. font-family: PingFang SC;
  241. font-weight: 500;
  242. color: #909399;
  243. text-align: right;
  244. margin-right:20rpx;
  245. max-width: 280rpx;
  246. }
  247. .order-content {
  248. font-size: 28rpx;
  249. font-family: PingFang SC;
  250. font-weight: 500;
  251. color: #909399;
  252. text-align: right;
  253. margin-right:20rpx;
  254. }
  255. switch, .uni-switch-wrapper, .uni-switch-input {
  256. width: 80rpx;
  257. height: 42rpx;
  258. }
  259. .iconfont {
  260. font-size: 30rpx;
  261. color: #909399;
  262. }
  263. label {
  264. font-size: 28rpx;
  265. color: #909399;
  266. }
  267. }
  268. .list-left {
  269. font-size: 28rpx;
  270. font-family: PingFang SC;
  271. font-weight: 500;
  272. color: #303133;
  273. }
  274. }
  275. .order-list:last-child {
  276. border:none;
  277. }
  278. .order-title {
  279. font-size: 32rpx;
  280. font-family: PingFang SC;
  281. font-weight: bold;
  282. color: #303133;
  283. margin-bottom: 10rpx;
  284. }
  285. }
  286. .footer-wrap {
  287. margin-top:80rpx;
  288. padding: 0 0 100rpx;
  289. }
  290. }
  291. </style>