select.vue 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252
  1. <template>
  2. <view class="app-content">
  3. <view class="ex-page">
  4. <view class="input-wrap">
  5. <view class="search-bar">
  6. <app-search-module v-model="py" placeholder="输拼音首字母也可以搜" @input="searchFn"/>
  7. </view>
  8. </view>
  9. <scroll-view scroll-y scroll-with-animation class="main-view">
  10. <view class="space-view ex-table">
  11. <view style="line-height:55upx;" v-if="!$util.isEmpty(selectList)">
  12. <text v-for="(item, index) in selectList" :key="index" style="margin-right:36upx;font-size:30upx;" @click="delProduct(item)">{{ item.name }} {{ item.bigCount }} x</text>
  13. <button @click="confirmChange()" class="admin-button-com blue mini-btn">确认添加</button>
  14. </view>
  15. <t-table :headerBackgroundColor="'#F0F2F6'">
  16. <block v-if="!$util.isEmpty(list.data)">
  17. <block v-for="(productItem, productIndex) in list.data" :key="productIndex">
  18. <t-tr>
  19. <t-td>
  20. <view style="width:230upx;text-align:left;color:black;font-size:28upx;
  21. overflow: hidden; white-space: nowrap; text-overflow: ellipsis;font-weight:bold;"
  22. @click="pageTo({url:'/admin/item/detail?id='+productItem.id})">
  23. <text style="color:#3385ff;margin-right:3upx;" v-if="productItem.frontHide == 1">隐</text>
  24. {{productItem.name}}
  25. </view>
  26. </t-td>
  27. <t-td>
  28. <input type="number" v-model="productItem.bigCount" class="inp-input" style="border:1upx solid #CCCCCC;font-size:29upx;color:black;" />
  29. </t-td>
  30. <t-td>
  31. <button @click="tjItem(productItem)" class="admin-button-com blue middle">添加</button>
  32. </t-td>
  33. </t-tr>
  34. </block>
  35. </block>
  36. </t-table>
  37. </view>
  38. </scroll-view>
  39. </view>
  40. </view>
  41. </template>
  42. <script>
  43. import AppWrapperEmpty from "@/components/app-wrapper-empty";
  44. import SelectList from "@/components/plugin/selectList";
  45. import { getProductDataApi,print,cancelDiscountPrice,cancelPreSell,delStatusUpdate } from "@/api/product";
  46. import { getSimleList } from "@/api/item";
  47. import { allOut } from "@/api/stock-out"
  48. import { list } from "@/mixins";
  49. import ShopSelect from "@/components/module/shopSelect";
  50. import DateSelect from "@/components/module/dateSelect";
  51. import {mapActions, mapGetters} from "vuex";
  52. import AppSearchModule from "@/components/module/app-search";
  53. import ModalModule from "@/components/plugin/modal"
  54. import { getWeixinId } from "@/api/invite";
  55. import { addItem } from "@/api/order-item";
  56. import productMins from "@/mixins/product";
  57. export default {
  58. components: { SelectList, AppWrapperEmpty,ShopSelect,DateSelect,AppSearchModule,ModalModule},
  59. computed: {
  60. ...mapGetters(["getDictionariesInfo","getLoginInfo","getMyShopInfo"])
  61. },
  62. mixins: [productMins,list],
  63. data() {
  64. return {
  65. selectJobType: "selectitem",
  66. py:'',
  67. currentInfo:{},
  68. printLabelShow:false,
  69. getAppIdList:{},
  70. printItemId:0,
  71. printType:0,
  72. printNum:'',
  73. printFocus:false,
  74. warning:0,
  75. posterUrl:'',
  76. breakNum:'',
  77. breakFocus:false,
  78. breakShow:false,
  79. checkStock:false
  80. };
  81. },
  82. onLoad() {
  83. this.getSimpleData()
  84. let that = this
  85. getWeixinId().then(res => {
  86. that.getAppIdList = res.data
  87. })
  88. this.selectJobId = this.option.id ? this.option.id : 0
  89. },
  90. onPullDownRefresh() {
  91. this.resetList();
  92. this.getSimpleData()
  93. uni.stopPullDownRefresh()
  94. },
  95. onReachBottom() {
  96. if (!this.list.finished) {
  97. this.getSimpleData().then((res) => {
  98. uni.stopPullDownRefresh()
  99. })
  100. } else {
  101. uni.stopPullDownRefresh()
  102. }
  103. },
  104. methods: {
  105. confirmChange(){
  106. let that = this
  107. if(this.$util.isEmpty(this.selectList)){
  108. this.$msg('请选择花材')
  109. return false
  110. }
  111. let id = this.option.id ? this.option.id : 0
  112. that.$util.confirmModal({content:'确认提交?'},() => {
  113. addItem({data:JSON.stringify(that.selectList),id:id}).then(res=>{
  114. if(res.code == 1){
  115. that.removeFromSaveDirect()
  116. uni.navigateBack()
  117. }
  118. })
  119. })
  120. },
  121. delProduct(item){
  122. let that = this
  123. that.$util.confirmModal({content:'确认删除?'},() => {
  124. that.delSelectedItem(item)
  125. })
  126. },
  127. tjItem(item){
  128. this.customData = item
  129. this.customData.userPrice = 0.1
  130. this.confirmAddItemModel(this.customData)
  131. item.bigCount=''
  132. this.$forceUpdate()
  133. },
  134. init(){
  135. },
  136. searchFn(){
  137. this.resetList()
  138. this.getSimpleData()
  139. },
  140. getSimpleData(){
  141. let that = this
  142. getSimleList({name:this.py,page: this.list.page}).then(res=>{
  143. this.completes(res)
  144. if (this.$util.isEmpty(res.data)){
  145. return false
  146. }
  147. })
  148. }
  149. }
  150. };
  151. </script>
  152. <style lang="scss" scoped>
  153. .ex-page {
  154. background: white;
  155. height: 100%;
  156. display: flex;
  157. flex-direction: column;
  158. .input-wrap {
  159. display: flex;
  160. padding: 22upx 20upx 22upx 13upx;
  161. .search-bar {
  162. flex: 1;
  163. }
  164. .city-select {
  165. display: flex;
  166. flex-shrink: 0;
  167. align-items: center;
  168. margin-right: 15upx;
  169. margin-left: 45upx;
  170. background-color: #ffff;
  171. .iconfont {
  172. margin-left: 20upx;
  173. font-size: 30upx;
  174. }
  175. }
  176. }
  177. .top-bar {
  178. position: absolute;
  179. left: 0;
  180. display: flex;
  181. width: 100%;
  182. top:130upx;
  183. z-index: 20;
  184. .bar{
  185. width: 50%;
  186. height: 100%;
  187. text-align: center;
  188. &:nth-child(1){
  189. border-right: 1upx solid #eeeeec;
  190. }
  191. }
  192. }
  193. .main-view {
  194. margin-top:10upx;
  195. flex: 1;
  196. background-color: #f9fbfc;
  197. .space-view {
  198. background-color: #fff;
  199. }
  200. .ex-info {
  201. padding: 30upx;
  202. .info-cell {
  203. display: flex;
  204. align-items: center;
  205. font-size: 28upx;
  206. &:not(:first-child) {
  207. margin-top: 20upx;
  208. }
  209. .cell-label {
  210. width: 110upx;
  211. color: #666666;
  212. }
  213. .cell-value {
  214. margin-left: 40upx;
  215. color: #333;
  216. &.warning {
  217. color: #ffaf1d;
  218. }
  219. &.success {
  220. color: #27c325;
  221. }
  222. }
  223. }
  224. }
  225. .ex-table {
  226. ::v-deep.icon-info {
  227. color: #333333;
  228. }
  229. }
  230. }
  231. .bar-view {
  232. display: flex;
  233. justify-content: space-between;
  234. align-items: center;
  235. padding: 0 30upx;
  236. width: 100%;
  237. height: 100upx;
  238. box-shadow: 0upx -1upx 6upx 0upx rgba(4, 0, 0, 0.06);
  239. .info-view {
  240. font-size: 26upx;
  241. }
  242. .btn-view {
  243. display: flex;
  244. .admin-button-com {
  245. margin: 0 10upx;
  246. }
  247. }
  248. }
  249. }
  250. </style>