Addstores.vue 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318
  1. <template>
  2. <view class="titlenav">
  3. <view class="top">
  4. <!-- <titlenav :flag="true"></titlenav> -->
  5. <view>
  6. <view class="title">商品管理</view>
  7. <view class="search">
  8. <image class="sousuo" src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-16-09-53-26QAqibCrM.png" mode=""></image>
  9. <view class="placeholder">搜索</view>
  10. </view>
  11. <u-tabs :current="tab" active-color="#ffffff" inactive-color="#ffffffcc" :list="tabs" :bg-color="$colors.prim" :is-scroll="false" @change="changeTab"></u-tabs>
  12. </view>
  13. </view>
  14. <view class="content">
  15. <view class="tabs">
  16. <view class="tab" :class="{ active: item === active }" v-for="(item, index) in tabs2" :key="index" @click="change(item)">{{ item }}</view>
  17. </view>
  18. <view class="storeCon" v-if="status">
  19. <view class="merchantroCon" v-for="(item, index) in merchantorListsData" :key="index">
  20. <image
  21. v-if="show"
  22. style="width:24px;height:24px;margin-left:5px;"
  23. :src="`https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/${list.includes(item.id) ? '2021-09-29-15-24-20LcnkHdXx.png' : '2021-09-02-14-49-00OrkCuHPB.png'}`"
  24. @click="pushId(item.id)"
  25. mode=""
  26. ></image>
  27. <image class="img" :src="item.image" mode=""></image>
  28. <view>
  29. <view class="text1">{{ item.name }}</view>
  30. <view class="text2">月销226&nbsp;&nbsp; 库存30/60</view>
  31. <view class="price" v-if="tab != 2">¥20.00</view>
  32. <view class="price" v-if="tab == 2 && show == false">库存不足</view>
  33. <view class="addcon" v-if="tab == 2 && show == true">
  34. <view>
  35. <img
  36. class="add"
  37. :src="`https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/${item.currentNum ? '2021-09-29-14-52-08uxMdZpar.png' : '2021-09-29-14-52-26BrhdOJqT.png'}`"
  38. alt=""
  39. @click="minus(item)"
  40. />
  41. </view>
  42. <view class="text">{{ item.currentNum }}</view>
  43. <view><img class="add" src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-29-14-51-44FFpxEAAP.png" alt="" @click="add(item)" /></view>
  44. </view>
  45. </view>
  46. </view>
  47. </view>
  48. </view>
  49. <view class="btn" v-if="!show">
  50. <view class="bottom" @click="navigateTo('/pages/Storeclassification')">
  51. <image class="imgBox" src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-29-10-32-11ViwbrsTU.png" mode=""></image>
  52. <view class="name">分类管理</view>
  53. <text class="border"></text>
  54. </view>
  55. <view class="bottom" @click="show = true">
  56. <image class="imgBox" src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-29-10-32-33BsbfsGzW.png" mode=""></image>
  57. <view class="name">批量操作</view>
  58. <text class="border"></text>
  59. </view>
  60. <view class="bottom" @click="navigateTo('/pages/Addcommodity')">
  61. <image class="imgBox" src="https://ticket-exchange.oss-cn-hangzhou.aliyuncs.com/image/2021-09-29-10-32-52ObSGBFre.png" mode=""></image>
  62. <view class="name">新增商品</view>
  63. </view>
  64. </view>
  65. <view class="btn" v-else>
  66. <u-button block class="btn2" @click="dele">删除</u-button>
  67. <u-button block class="btn2" @click="show = false">完成</u-button>
  68. <u-button block type="primary" @click="submit">{{ !Tab ? '上架出售' : '下架出售' }}</u-button>
  69. </view>
  70. </view>
  71. </template>
  72. <script>
  73. import { mapState } from 'vuex';
  74. import Titlenav from '../components/Titlenav.vue';
  75. import { merchantorLists } from '../mock/merchantorList.js';
  76. export default {
  77. components: { Titlenav },
  78. data() {
  79. return {
  80. tab: 0,
  81. show: false,
  82. list: [],
  83. merchantorListsData: [],
  84. tabs: [{ name: '出售中' }, { name: '未上架' }, { name: '已售磬' }],
  85. form: {},
  86. tabs2: ['热销', '清新素粥'],
  87. active: '热销'
  88. };
  89. },
  90. created() {
  91. merchantorLists.forEach(item => {
  92. // 数量
  93. item.currentNum = 0;
  94. this.merchantorListsData.push(item);
  95. });
  96. },
  97. computed: {
  98. ...mapState(['systemInfo']),
  99. status() {
  100. if (this.active == '热销') {
  101. return true;
  102. } else {
  103. return false;
  104. }
  105. },
  106. Tab() {
  107. if (this.tab == 0) {
  108. return true;
  109. } else {
  110. return false;
  111. }
  112. }
  113. },
  114. methods: {
  115. changeTab(index) {
  116. this.tab = index;
  117. },
  118. change(e) {
  119. this.active = e;
  120. },
  121. checkId(id) {
  122. return this.list.includes(id);
  123. },
  124. pushId(id) {
  125. if (this.checkId(id)) {
  126. this.list.splice(this.list.indexOf(id), 1);
  127. } else {
  128. this.list.push(id);
  129. }
  130. },
  131. submit() {
  132. if (this.tab == 0) {
  133. console.log(111);
  134. } else if (this.tab == 1) {
  135. console.log(222);
  136. } else {
  137. console.log(333);
  138. }
  139. },
  140. add(item) {
  141. item.currentNum++;
  142. },
  143. minus(item) {
  144. if (item.currentNum != 0) {
  145. item.currentNum--;
  146. }
  147. }
  148. }
  149. };
  150. </script>
  151. <style lang="scss" scoped>
  152. .titlenav {
  153. background: #214bbe;
  154. .top {
  155. // position: sticky;
  156. // z-index: 999;
  157. // top: 80px;
  158. background: #214bbe;
  159. padding-bottom: 10px;
  160. .title {
  161. font-size: 22px;
  162. font-weight: bold;
  163. color: #ffffff;
  164. line-height: 26px;
  165. padding: 10px 0 16px 20px;
  166. }
  167. .search {
  168. height: 32px;
  169. background: rgb(69, 116, 204);
  170. border-radius: 16px;
  171. margin: 0 20px;
  172. display: flex;
  173. justify-content: center;
  174. align-items: center;
  175. flex-wrap: nowrap;
  176. .placeholder{
  177. font-size: 14px;
  178. font-weight: 400;
  179. color: #FFFFFF;
  180. line-height: 24px;
  181. }
  182. .sousuo {
  183. width: 16px;
  184. height: 16px;
  185. margin-right: 8px;
  186. }
  187. }
  188. }
  189. .content {
  190. background: #ffffff;
  191. border-radius: 16px 16px 0px 0px;
  192. padding: 0px 20px;
  193. display: flex;
  194. .tabs {
  195. width: 80px;
  196. min-height: 100vh;
  197. background: #f2f3f5;
  198. border-radius: 16px 0px 0px 0px;
  199. font-size: 13px;
  200. margin-left: -20px;
  201. font-weight: 400;
  202. padding-top: 16px;
  203. text-align: center;
  204. color: #939599;
  205. .tab {
  206. height: 34px;
  207. line-height: 34px;
  208. &.active {
  209. color: #000000;
  210. font-weight: bold;
  211. height: 34px;
  212. background: #ffffff;
  213. line-height: 34px;
  214. }
  215. }
  216. }
  217. .storeCon {
  218. .merchantroCon {
  219. display: flex;
  220. align-items: center;
  221. margin-bottom: 20px;
  222. margin-top: 16px;
  223. .img {
  224. width: 80px;
  225. height: 80px;
  226. border-radius: 8px;
  227. margin: 0 10px;
  228. }
  229. .text1 {
  230. font-size: 16px;
  231. font-weight: 400;
  232. color: #000000;
  233. line-height: 24px;
  234. }
  235. .text2 {
  236. font-size: 13px;
  237. font-weight: 400;
  238. color: #939599;
  239. line-height: 24px;
  240. margin-bottom: 6px;
  241. }
  242. .price {
  243. font-size: 14px;
  244. font-weight: bold;
  245. color: #ff7f1f;
  246. line-height: 24px;
  247. }
  248. .addcon {
  249. display: flex;
  250. align-items: center;
  251. .text {
  252. width: 24px;
  253. height: 24px;
  254. text-align: center;
  255. line-height: 24px;
  256. background: #f5f7fa;
  257. margin: 0 4px;
  258. }
  259. .add {
  260. width: 24px;
  261. height: 24px;
  262. margin-top: 4px;
  263. line-height: 24px;
  264. }
  265. }
  266. }
  267. }
  268. }
  269. /deep/ .u-btn {
  270. width: 100px;
  271. height: 48px;
  272. font-size: 16px;
  273. border-radius: 4px;
  274. }
  275. .btn {
  276. display: flex;
  277. align-items: center;
  278. position: fixed;
  279. justify-content: space-between;
  280. left: 0;
  281. right: 0;
  282. bottom: 0;
  283. z-index: 100;
  284. padding: 6px 20px;
  285. padding-bottom: 34px;
  286. padding-bottom: calc(34px + constant(safe-area-inset-bottom)); // 兼容 IOS<11.2
  287. padding-bottom: calc(34px + env(safe-area-inset-bottom)); // 兼容 IOS>=11.2
  288. background-color: #ffffff;
  289. .btn2 {
  290. color: #214bbe;
  291. text-align: center;
  292. }
  293. .bottom {
  294. display: flex;
  295. align-items: center;
  296. padding: 12px 0 6px;
  297. .name {
  298. font-size: 16px;
  299. font-weight: bold;
  300. color: #214bbe;
  301. line-height: 24px;
  302. margin-left: 4px;
  303. }
  304. .imgBox {
  305. width: 24px;
  306. height: 24px;
  307. }
  308. .border {
  309. width: 1px;
  310. height: 30px;
  311. background: #e5e5e5;
  312. border-radius: 1px;
  313. margin-left: 14px;
  314. }
  315. }
  316. }
  317. }
  318. </style>