index.vue 8.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283
  1. <template>
  2. <!-- #ifdef H5 -->
  3. <zj-page-layout :hasFooter="true">
  4. <view class="form-container">
  5. <!-- <view class="item" @tap="isShowBrandDialog = true">
  6. <view class="label"><text>*</text>品牌</view>
  7. <view class="picker">
  8. <text class="value" v-if="brand">{{brand.brandName}}</text>
  9. <text class="placeholder" v-else>请选择</text>
  10. <text class="iconfont icon-jinru"></text>
  11. </view>
  12. </view> -->
  13. <view class="item" v-if="type == 'P'" @tap="isShowCategoryDialog = true">
  14. <view class="label"><text>*</text>产品大类</view>
  15. <view class="picker">
  16. <text class="value" v-if="category">{{ category.name }}</text>
  17. <text class="placeholder" v-else>请选择</text>
  18. <text class="iconfont icon-jinru"></text>
  19. </view>
  20. </view>
  21. <!-- <view class="item">
  22. <view class="label"><text>*</text>销售方式</view>
  23. <u-radio-group v-model="salesType">
  24. <u-radio shape="circle" label="外购" :name="'OUT'"></u-radio>
  25. <u-radio shape="circle" label="自有仓库" :name="'OWN'"></u-radio>
  26. </u-radio-group>
  27. </view> -->
  28. <u-gap height="10" bgColor="#F7F8FF"></u-gap>
  29. <view class="item">
  30. <view class="label"><text>*</text>客户电话</view>
  31. <!-- :readonly="hasOid" -->
  32. <u--input
  33. :maxlength="11"
  34. placeholder="请输入"
  35. border="none"
  36. inputAlign="right"
  37. v-model="userMobile"
  38. ></u--input>
  39. </view>
  40. <view class="item">
  41. <view class="label">工单单号</view>
  42. <u--input :readonly="hasOid" placeholder="请输入" border="none" inputAlign="right" v-model="orderNo"></u--input>
  43. </view>
  44. <view class="item" @tap="hasOid ? '' : (isShowWebsitDialog = true)">
  45. <view class="label"><text>*</text>所属网点</view>
  46. <view class="picker">
  47. <text class="value" v-if="websit">{{ websit.name }}</text>
  48. <text class="placeholder" v-else>请选择工单所属网点</text>
  49. <text class="iconfont icon-jinru"></text>
  50. </view>
  51. </view>
  52. </view>
  53. <template slot="footer">
  54. <view class="footer-btn-group">
  55. <u-button
  56. text="历史记录"
  57. @click="$navToPage({ url: `/packageMaterial/pages/sale/orderList?type=${type}` })"
  58. ></u-button>
  59. <u-button type="primary" text="选择产品" @click="toChooseProduct"></u-button>
  60. </view>
  61. </template>
  62. <zjDialogPicker
  63. ref="brandDialog"
  64. :isShow="isShowBrandDialog"
  65. :multiple="false"
  66. :styleType="2"
  67. :title="'品牌'"
  68. :list="brandList"
  69. :keyName="'brandName'"
  70. @cancel="isShowBrandDialog = false"
  71. @confirm="confirmBrandDialog"
  72. >
  73. </zjDialogPicker>
  74. <zjDialogPicker
  75. ref="categoryDialog"
  76. :isShow="isShowCategoryDialog"
  77. :multiple="false"
  78. :styleType="2"
  79. :title="'产品大类'"
  80. :list="categoryList"
  81. :keyName="'name'"
  82. @cancel="isShowCategoryDialog = false"
  83. @confirm="confirmCategoryDialog"
  84. >
  85. </zjDialogPicker>
  86. <zjDialogPicker
  87. ref="websitDialog"
  88. :isShow="isShowWebsitDialog"
  89. :multiple="false"
  90. :styleType="2"
  91. :title="'所属网点'"
  92. :list="websitList"
  93. :keyName="'name'"
  94. @cancel="isShowWebsitDialog = false"
  95. @confirm="confirmWebsitDialog"
  96. >
  97. </zjDialogPicker>
  98. </zj-page-layout>
  99. <!-- #endif -->
  100. <!-- #ifndef H5 -->
  101. <web-view
  102. :src="webViewHref(`/packageMaterial/pages/sale/index`, pam, crossPagePam)"
  103. @message="crossPage.$listener"
  104. ></web-view>
  105. <!-- #endif -->
  106. </template>
  107. <script>
  108. // #ifdef H5
  109. import zjDialogPicker from "@/components/zj-dialog/zj-dialog-picker.vue";
  110. export default {
  111. components: {
  112. zjDialogPicker
  113. },
  114. data() {
  115. return {
  116. hasOid: false,
  117. wbId: null, // 维保工单
  118. wbIsAllFee: null, // 维保工单是否包含全部费用
  119. wbPayType: null, // 维保工单费用支付方式
  120. type: 'M',
  121. userMobile: '',
  122. orderNo: '',
  123. salesType: 'OUT',
  124. brand: null,
  125. brandList: [],
  126. isShowBrandDialog: false,
  127. category: null,
  128. categoryList: [],
  129. isShowCategoryDialog: false,
  130. websit: null,
  131. websitList: [],
  132. isShowWebsitDialog: false,
  133. }
  134. },
  135. onLoad({type, oid = ''}) {
  136. this.type = type;
  137. this.hasOid = oid.length > 0;
  138. uni.setNavigationBarTitle({
  139.  title: type == 'M' ? '辅材收款' : '配件收款'
  140. })
  141. this.getBrandList();
  142. this.getWebsitList();
  143. if(type == 'P') {
  144. this.getCategoryList();
  145. }
  146. if(this.hasOid) {
  147. this.$api.post('/pg/order/base/detail', {
  148. orderBaseId: oid,
  149. }).then((res) => {
  150. const data = res.data;
  151. this.orderNo = oid;
  152. this.userMobile = data.userMobile;
  153. this.websit = {
  154. websitId: data.websitId,
  155. name: data.websitName,
  156. }
  157. if(data.pgOrderProducts && data.pgOrderProducts.length > 0) {
  158. this.brand = {
  159. id: data.pgOrderProducts[0].brandId,
  160. brandName: data.pgOrderProducts[0].brandName
  161. }
  162. }
  163. this.wbId = data.rpProjectRepairId || '';
  164. this.wbIsAllFee = data.isAllFee || '';
  165. this.wbPayType = data.feePayMethod || '';
  166. })
  167. }
  168. },
  169. methods: {
  170. getBrandList() {
  171. this.$api.post('/pay/getBrand')
  172. .then(res => {
  173. this.brandList = res.data;
  174. })
  175. },
  176. getCategoryList() {
  177. this.$api.post('/pay/getCategoryList')
  178. .then(res => {
  179. this.categoryList = res.data;
  180. })
  181. },
  182. getWebsitList() {
  183. this.$api.get('/user/apply/websit')
  184. .then(res => {
  185. this.websitList = res.data;
  186. })
  187. },
  188. confirmBrandDialog(e) {
  189. this.brand = this.brandList[e[0]];
  190. this.isShowBrandDialog = false;
  191. },
  192. confirmCategoryDialog(e) {
  193. this.category = this.categoryList[e[0]];
  194. this.isShowCategoryDialog = false;
  195. },
  196. confirmWebsitDialog(e) {
  197. this.websit = this.websitList[e[0]];
  198. this.isShowWebsitDialog = false;
  199. },
  200. toChooseProduct() {
  201. // if(!this.brand) return this.$toast('请选择品牌');
  202. if(this.type == 'P' && !this.category) return this.$toast('请选择产品大类');
  203. if(!this.websit) return this.$toast('请选择所属网点');
  204. if(!this.userMobile) return this.$toast('请输入客户电话');
  205. if(!(/^1[3456789]\d{9}$/.test(this.userMobile)) || this.userMobile.length != 11) return this.$toast('请填写正确的客户电话');
  206. // this.$navToPage({
  207. // url: `/packageMaterial/pages/sale/product?type=${this.type}&brandId=${this.brand.id}&brandName=${this.brand.brandName}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&salesType=${this.salesType}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
  208. // })
  209. this.$navToPage({
  210. url: `/packageMaterial/pages/sale/product?type=${this.type}&categoryId=${this.type=='P'?this.category.categoryId:''}&categoryName=${this.type=='P'?this.category.name:''}&userMobile=${this.userMobile}&orderNo=${this.orderNo}&websitId=${this.websit.websitId}&websitName=${this.websit.name}&wbId=${this.wbId||''}&wbIsAllFee=${this.wbIsAllFee||''}&wbPayType=${this.wbPayType||''}`
  211. })
  212. },
  213. },
  214. }
  215. // #endif
  216. // #ifndef H5
  217. export default {
  218. data() {
  219. return {
  220. pam: {},
  221. }
  222. },
  223. onLoad(pam) {
  224. this.pam = pam;
  225. }
  226. }
  227. // #endif
  228. </script>
  229. <style lang="scss" scoped>
  230. .form-container {
  231. background: #ffffff;
  232. margin-top: 20rpx;
  233. border-top: 1px solid #f5f5f5;
  234. .item {
  235. height: 108rpx;
  236. border-bottom: 1px solid #f5f5f5;
  237. display: flex;
  238. align-items: center;
  239. justify-content: space-between;
  240. padding: 0 20rpx;
  241. .label {
  242. margin-right: 30rpx;
  243. text {
  244. color: $error-color;
  245. }
  246. }
  247. .picker {
  248. .placeholder {
  249. color: $sec-font;
  250. }
  251. .iconfont {
  252. margin-left: 12rpx;
  253. color: $sec-font;
  254. }
  255. }
  256. ::v-deep .u-radio-group {
  257. flex: unset;
  258. .u-radio {
  259. margin-left: 50rpx;
  260. }
  261. }
  262. }
  263. }
  264. </style>