storeList.vue 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970
  1. <template>
  2. <view>
  3. <z-slide-card :title="title" :visible.sync="isvisible" @beforeClose="beforeClose" rightBtnText="切换" @rightClick="submit">
  4. <z-cell :label="item.storeName" v-for="(item,index) in dataList" :key="item.storeId" @click.native="choose=item.storeId">
  5. <view class="iconfont iconicon-test" v-if="choose==item.storeId"></view>
  6. </z-cell>
  7. </z-slide-card>
  8. </view>
  9. </template>
  10. <script>
  11. const app = getApp({allowDefault: true});
  12. export default{
  13. props:{
  14. visible:Boolean,
  15. title:{
  16. type:String,
  17. default:'变更店铺为'
  18. }
  19. },
  20. data(){
  21. return{
  22. isvisible: false,
  23. dataList:[],
  24. checkedList:[],
  25. oldcheckedList: [],
  26. chooseContent:'',
  27. choose:''
  28. }
  29. },
  30. watch:{
  31. visible(newval,oldval){
  32. console.log(newval)
  33. this.isvisible=newval;
  34. this.getData();
  35. },
  36. },
  37. mounted(){
  38. },
  39. methods:{
  40. getData(){
  41. uni.getStorage({
  42. key:'storeInfo',
  43. success: (res) => {
  44. this.dataList=res.data.store;
  45. this.choose=uni.getStorageSync('storeId');
  46. }
  47. })
  48. },
  49. beforeClose(){
  50. this.$emit('update:visible', false)
  51. },
  52. submit(){
  53. uni.setStorage({
  54. key:'storeId',
  55. data:this.choose
  56. })
  57. this.$emit('submit');
  58. this.$emit('update:visible', false)
  59. },
  60. }
  61. }
  62. </script>
  63. <style lang="scss" scoped>
  64. .iconfont{
  65. color: #2481EE;
  66. }
  67. </style>